By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,122 Members | 1,554 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,122 IT Pros & Developers. It's quick & easy.

Strange include order problems

P: n/a

Compiler: GCC 3.3.5
OS: SuSE Linux (Kernel: 2.6.11)

I reorganized my source code and now almost all my header files went
to "Include" folder.
Now when compiling with -I option I have plenty of problems with
system include files:
"conflict with previous declaration"
c++ -c -I../Include AmaSocket.cpp
C++ Libs source compilation AmaSocket.cpp ...
In file included from /usr/include/stdlib.h:43,
from /usr/include/c++/3.3.5/cstdlib:52,
from /usr/include/c++/3.3.5/bits/stl_algobase.h:67,
from /usr/include/c++/3.3.5/memory:54,
from /usr/include/c++/3.3.5/string:48,
from ../Include/AmaStr.h:12,
from ../Include/AmaSocket.h:5,
from AmaSocket.cpp:4:
/usr/include/bits/waitstatus.h:80: error: declaration of `unsigned
wait::<anonymous struct>::__w_retcode'
/usr/include/bits/waitstatus.h:75: error: conflicts with previous
declaration `
unsigned int wait::<anonymous struct>::__w_retcode'

When I change
option to
compilation goes without earlier problems, but up to moment where I
have my own header files named the same as system (i.e. list.h with my
classes working on lists). In this case #include "list.h" acts as I
would include system file, not my own from "../Include"

#include "list.h" // my own file inside ../Include folder

When I specify exactly #include "../Include/AmaSocket.h" without using
"-I../Include" then I do not have any problems with conflicting

Any comments?

Thanks in advance

May 2 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I'd like to add compiler's output:

c++ -v -c -idirafter../Include -idirafter../appserver/Include
C++ Libs source compilation list.cpp ...
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.5/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --
with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/
share/man --enable-languages=c,c++,f77,objc,java,ada --disable-
checking --libdir=/usr/lib --enable-libgcj --with-slibdir=/lib --with-
system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/cc1plus -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=5 -D_GNU_SOURCE -idirafter../
Include -idirafter../appserver/Include list.cpp -D__GNUG__=3 -quiet -
dumpbase list.cpp -auxbase list -version -o /tmp/ccjHxni4.s
ignoring nonexistent directory "../appserver/Include"
GNU C++ version 3.3.5 20050117 (prerelease) (SUSE Linux) (i586-suse-
compiled by GNU C version 3.3.5 20050117 (prerelease) (SUSE Linux).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-
#include "..." search starts here:
#include < starts here:
End of search list.
In file included from /usr/include/c++/3.3.5/backward/list.h:59,
from list.cpp:3:
/usr/include/c++/3.3.5/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section of the C++ standard. Examples include substituting the <X>
header for the <X.hheader for C++ includes, or <sstreaminstead of
the deprecated header <strstream.h>. To disable this warning use -Wno-
list.cpp:19: error: syntax error before `::' token
May 2 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.