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: can't find c++ header files


>>>>> "Todd" == Todd Kokoszka <kokostm@auburn.edu> writes:

    Todd> Hello,
 
    Todd> I recently installed gcc 3.0.4 while keeping gcc 2.95.3 on
    Todd> my machine. I'd like to use 3.0.4 to compile c++ and java
    Todd> programs. I didn't know where to put the c++ parts of 3.0.4
    Todd> that I want to use without screwing up the 2.95.3 C stuff,
    Todd> so I stuck 3.0.4 in /usr/local/gcc-3.0.4 -- maintaining the
    Todd> installation hierarchy.

    Todd> When I try to compile a simple c++ program, that just prints
    Todd> the value of a variable, the compiler tells me that cout and
    Todd> endl are not declared. I included the iostream header, set
    Todd> the CPLUS_INCLUDE_PATH, and COMPILER_PATH environement
    Todd> varialbes to the new location under /usr/local/gcc-3.0.4 and
    Todd> even passed the directory with -I.  I tried using the
    Todd> standard #include <iostream> and #include "direct path to
    Todd> file" and neither worked.

Why didn't you simply post the code, the command line you've used to
compile your program and the error messages of GCC instead of vaguely
describing what you did?

Also, it's quite a difference if GCC said that cout and endl are not
defined or that it couldn't find the header file.

You may use the -v switch of GCC in order to find out where it looks
for its header files.

Be aware that cout and endl are defined in namespace std. So, you need
to specify the namespace explicitly ( std::cout << "hello" <<
std::endl; ) or add a `using' declaration to your code ( using
namespace std; OR using std::cout; using std::endl; ).

    Todd> If anyone has any ideas what I'm missing or where to find
    Todd> information abou t how to install two compilers like I want
    Todd> to, I'm happy to hear them.

HTH
Claudio


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