Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* C++ compile problem on osf/1
@ 1994-10-19 14:50 David McDougall
  1994-10-20 13:07 ` Mark Charette
  1994-10-20 14:40 ` Russ Russell
  0 siblings, 2 replies; 3+ messages in thread
From: David McDougall @ 1994-10-19 14:50 UTC (permalink / raw)


Hi Folks,
          I have a program that happily compiles
using the standard c compiler on a DEC 3000/300
running OSF/1 v1.3. It uses a few ioctl calls to
do various things. I have ported the code to C++
and I am getting a ridiculous error which states
the following:

"dec_interface.C:44: error: In this statement, "ioctl" is not declared."

Now line 44 is identical in syntax to the c version and I
have included the #include <sys/ioctl.h> line in my c++ header
file. Does anyone know whats wrong or had a similar problem.
Things are getting silly as there is nothing obviously wrong.
Famous last words. Are there any defines I should be setting for the
compiler command.

All/Any help is much appreciated.

I can supply more info if it looks like that will help.

Cheers
       Dave.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C++ compile problem on osf/1
  1994-10-19 14:50 C++ compile problem on osf/1 David McDougall
@ 1994-10-20 13:07 ` Mark Charette
  1994-10-20 14:40 ` Russ Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Charette @ 1994-10-20 13:07 UTC (permalink / raw)


David McDougall (davidm@bri.hp.com) wrote:
: and I am getting a ridiculous error which states
: the following:
: "dec_interface.C:44: error: In this statement, "ioctl" is not declared."
: Now line 44 is identical in syntax to the c version and I
: have included the #include <sys/ioctl.h> line in my c++ header
: file. Does anyone know whats wrong or had a similar problem.

If you look in the ioctl.h file under OSF/1 1.3 you'll notice that there is
no prototype for ioctl in there. Fixed in (at least) OSF/1 3.0.

The error message is explicit. In C (if you didn't use -std1 -w0) ioctl would
default to an int function (which it is). If you used the -std1 -w0 option
on the C compiler it would complain abount no prototype in scope.

Mark Charette
charette@mika.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C++ compile problem on osf/1
  1994-10-19 14:50 C++ compile problem on osf/1 David McDougall
  1994-10-20 13:07 ` Mark Charette
@ 1994-10-20 14:40 ` Russ Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Russ Russell @ 1994-10-20 14:40 UTC (permalink / raw)


In article <CxxD8t.9E0@bri.hp.com> David McDougall, davidm@bri.hp.com writes:
>Hi Folks,
>          I have a program that happily compiles
>using the standard c compiler on a DEC 3000/300
>running OSF/1 v1.3. It uses a few ioctl calls to
>do various things. I have ported the code to C++
>and I am getting a ridiculous error which states
>the following:
>
>"dec_interface.C:44: error: In this statement, "ioctl" is not declared."
>
>Now line 44 is identical in syntax to the c version and I
>have included the #include <sys/ioctl.h> line in my c++ header
>file. Does anyone know whats wrong or had a similar problem.
>Things are getting silly as there is nothing obviously wrong.
>Famous last words. Are there any defines I should be setting for the
>compiler command.

Make sure that you put 

extern "C" {
}

around all your system includes for C commands. Remember that C defaults
a function to int, but c++ has no defaults, so EVERY function must be 
explicitly declared. In compiling my MUD in DEC c++, I even had to declare
a couple of system functions (select for example) in my own header files,
because they were int functions, and for some reason weren't externed in
the system includes.

It will surely work if you do the extern "C" {}, and if you have to 
declare the function in your own header files.


-----------------------------------------------------
Russ Russell, Network Engineer and UNIX Administrator
Coleman Research Corporation
Contractor to and for the U.S. Department of Energy
Russ.Russell@em.doe.gov

Brutius at SneezyMUD(128.162.19.9 7900)

My views are mine, and do not necessarily reflect 
the views of Coleman Research or the U.S. DOE
-----------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1994-10-20 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-19 14:50 C++ compile problem on osf/1 David McDougall
1994-10-20 13:07 ` Mark Charette
1994-10-20 14:40 ` Russ Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox