libstdc++-v3 build failure

Benjamin Kosnik bkoz@redhat.com
Tue Apr 17 11:26:00 GMT 2001


probably best to just treat the declaration in unistd.h as a "C" declaration.

> /play/egcs/libstdc++-v3/include/c_std/bits/std_cstdlib.h:115: previous
>    declaration of `void std::exit(int)' with C linkage
> /udk/usr/include/unistd.h:271: conflicts with new declaration with C++ linkage
> /udk/usr/include/unistd.h:271: `exit' is already declared in this scope
> make[2]: *** [basic_file.lo] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive-am] Error 2

ugh.

> When I look in <unistd.h>, I find this horror of a construct:
> 
> extern int      acct(const char *);
> #if defined(__cplusplus) && !defined(_CFRONT_3_0)
> namespace std { extern "C++" void exit(int); } using std::exit;
> #else
> extern void     exit(int);
> #endif

Clearly, you want g++ to see:

extern void     exit(int);

Using fixincludes to change the header file to:

#if defined(__cplusplus) && !defined(_CFRONT_3_0) && !defined(__GNUG__)
 namespace std { extern "C++" void exit(int); } using std::exit;
#else
 extern void     exit(int);
#endif

Should work.

-benjamin



More information about the Gcc-bugs mailing list