This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Compiler Error Indication. What is wrong?[2] - Please ignoremy previous email
- From: John Love-Jensen <eljay at adobe dot com>
- To: George Thanos <gthanos at telecom dot ntua dot gr>, gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 02 Oct 2002 13:36:13 -0500
- Subject: Re: Compiler Error Indication. What is wrong?[2] - Please ignoremy previous email
Hi George,
Use this bash trick to search the source files header files:
grep -n -w __kernel_fd_set $(
echo $(g++ -M foo.cpp)
| sed -e 's@ \\ @ @g'
| cut -d ' ' -f3-
)
It's a bit easier if it's put into your .bashrc as a helper function. I'll
leave that as an exercise for the reader. NOTE: I'm ASSUMING you don't
have spaces in your files and paths. Handling spaces is possible, but
trickier.
This may help you locate the duplicate definition is the mystery header
file.
A breakdown:
First line, search for whole-word __kernel_fd_set, with line numbers.
Second line, display included header files, the 'echo' removes newlines.
Third line, trims out ' \ ' sequences.
Fourth line, removes the makefile target name and source file name.
If you don't use bash, other shells can solve the same need in their own
peculiar ways. (I don't consider Microsoft's CMD a "shell".)
--Eljay