From: Russ Russell <russ.russell@em.doe.gov>
Subject: Re: C++ compile problem on osf/1
Date: 20 Oct 1994 14:40:30 GMT [thread overview]
Message-ID: <385vgu$ieo@news.em.doe.gov> (raw)
In-Reply-To: CxxD8t.9E0@bri.hp.com
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
-----------------------------------------------------
prev parent reply other threads:[~1994-10-20 14:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox