473,472 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Strange include order problems

Hi,

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
int
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
-I"../Include"
option to
-idirafter"../Include"
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"

list.cpp:
#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
declarations.

Any comments?

Thanks in advance
zmk

May 2 '07 #1
1 3467
I'd like to add compiler's output:

c++ -v -c -idirafter../Include -idirafter../appserver/Include
list.cpp
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-
linux)
compiled by GNU C version 3.3.5 20050117 (prerelease) (SUSE Linux).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-
heapsize=131072
#include "..." search starts here:
#include <...search starts here:
/usr/include/c++/3.3.5
/usr/include/c++/3.3.5/i586-suse-linux
/usr/include/c++/3.3.5/backward
/usr/local/include
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/include
/usr/i586-suse-linux/include
/usr/include
../Include
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
17.4.1.2 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-
deprecated.
list.cpp:19: error: syntax error before `::' token
May 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
6
by: Ben Taylor | last post by:
I've asked about includes before in this group in order to stop files being #included either twice or not at all, and somebody said to use extern keyword for global variables that need to be used...
8
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and...
6
by: Gaijinco | last post by:
I was trying to solve: acm.uva.es/p/v101/10191.html I did this code: #include <iostream> #include <fstream> #include <string> #include <vector> #include <algorithm> #include <cctype>
6
by: robert | last post by:
I get python crashes and (in better cases) strange Python exceptions when (in most cases) importing and using cookielib lazy on demand in a thread. It is mainly with cookielib, but remember the...
4
by: ben.dixon | last post by:
Hi, I'm using links for navigation on a test page, so each link will go to a question in the test e.g. Question 1, Question 2 etc. For each link i am using an Outer Border, Middle border and...
2
by: Paul Furman | last post by:
I don't know, maybe this isn't strange but someone else set up the shopping card coding I'm working with, the way it works is to get the time() in seconds like 1172693735 and that's the shopper_ID...
8
by: FBM | last post by:
Hi there, I am puzzled with the behavior of my code.. I am working on a networking stuff, and debugging with eclipse (GNU gdb 6.6-debian).. The problem I am experiencing is the following: ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.