[LC++]g++ 3.0 warning messages
lloyd at acm.jhu.edu
Sat Jul 28 01:38:05 UTC 2001
> I have some problems with g++ warning messages. I like compiling
> my programs with all warnings enabled and it helps me to improve my
> programming style
> and to put some time from debugging into development. However,
> enabling all warning messages is very painful with g++ since I always
> get a lot of warning messages from the stl.
This should not happen.
> Is there a simple way to enable all warnings in the user code but
> disable warnings caused by standard includes (located in /usr/....)?
Let me guess. You installed gcc 3 on a system which comes with gcc 2.95.2
or a gcc3 snapshot, and you did not remove the libstdc++ headers that came
with the system. Thus, when you include an STL header, it includes an old
copy that has a lot of problems.
The reason I'm saying this is because I have been using gcc3 and get no
such warnings with "-ansi -W -Wall", which is my usual warning flag set.
Becaues I installed gcc3 into /usr/local/gcc-3.0, the STL code I use is in
/usr/local/gcc-3.0/include/g++-3 (note that I don't have to set anything
explicitly with -I or whatever; g++ knows to search there and will include
those files as long as it doesn't find other ones in /usr/include).
Here is a test to see if you're using the libstdc++ that's shipped with
gcc3. Look in /usr/include/g++-v3 or whatever directory these STL files
are being included from. You should basically see:
* All of the standard C++ headers (such as algorithm, vector, map, etc)
* A few .h files (cxxabi.h and I think one other)
* A "bits" directory with the actual STL implementation
* An ext directory containing things like hash_map and hash_set headers
* A machine specific directory (like i686-pc-linux-gnu) with the
numeric_limits header and some threading code.
Could you perhaps be more specific about what the warnings are/what files
they are from (and also what your system setup is)? I suppose it's
possible that there is some section of the STL that prints tons of errors
while the rest (algorithm, string, vector, map) is totally quiet but that
seems rather strange, so I'd kind of like to see some details on this.
More information about the tuxCPProgramming