This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: help with g++ 2.96
On Mon, Sep 22, 2003 at 11:31:05AM -0600, lrtaylor@micron.com wrote:
> Is it a C header? If so, try surrounding your include statement with
> 'extern "C" {' and '}' like this:
>
> extern "C" {
> #include <incfile.h>
> }
>
> This will cause that file to be compiled as C source code rather than
> C++ source code, which must follow stricter rules.
Not quite, the C++ syntax and semantics still apply, but the linking
convention is changed to "C". Usually, it is possible to include a C
header this way, but additional care is necessary if the header uses C++
keywords.