This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]