c++/7861: Finds executables instead of standard headers?

Zack Weinberg zack@codesourcery.com
Sun Feb 23 22:06:00 GMT 2003


Paul <paulf.johnson@ukonline.co.uk> writes:

> g++ test.cpp -o string
> Compiles fine.
>
> Change "Paul" to "Phil" (say), recompile and watch the fireworks!

Unable to reproduce this -

$ cat > test.cc
#include <string>
#include <iostream>

using namespace std;

int main()
{
  string hi = "Paul";
  cout << "Hello " << hi << endl;
}
$ g++ test.cc -o string ; echo $?
0
$ g++ test.cc -o string ; echo $?
0

I suspect you neglected to mention that you had -I. on your command
line, which is specifically asking for fireworks under these
conditions.

It would be sensible for cpplib to detect '\177ELF' at the beginning
of a file and abandon processing it, so as to avoid flooding the
user's terminal with unhelpful error messages.  (That string cannot
appear at the beginning of a well-formed C/C++ source file.)  But it
would still be an error.

zw



More information about the Gcc-bugs mailing list