public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* can't find c++ header files
@ 2002-07-11 13:06 Todd Kokoszka
  2002-07-11 14:03 ` Claudio Bley
  0 siblings, 1 reply; 2+ messages in thread
From: Todd Kokoszka @ 2002-07-11 13:06 UTC (permalink / raw)
  To: gcc-help

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

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

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

Thanks.

Todd



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: can't find c++ header files
  2002-07-11 13:06 can't find c++ header files Todd Kokoszka
@ 2002-07-11 14:03 ` Claudio Bley
  0 siblings, 0 replies; 2+ messages in thread
From: Claudio Bley @ 2002-07-11 14:03 UTC (permalink / raw)
  To: gcc-help

>>>>> "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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-11 21:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-11 13:06 can't find c++ header files Todd Kokoszka
2002-07-11 14:03 ` Claudio Bley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).