This is the mail archive of the gcc@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]

Re: Issue with GCC



> I am trying to port Visual C++ code to GCC 2.95.2 on Linux. In doing that, I
> have encountered some problems that may easily be replicated with the
> following execution. Am I not linking with a particular library? Please let
> me know what I am doing wrong.  Thank you!
> 
> *********************************************************************
> 
> gcc -o complextest -fhonor-std complextest.cpp -lm -lobjc -lstdc++
>
> complextest.cpp: In function `int main(...)':
> complextest.cpp:4: `cout' undeclared in namespace `std'
> complextest.cpp:4: `endl' undeclared in namespace `std' 

Drop the "-fhonor-std" flag.  You will then get the default "fake std::"
mode and the program will work.  We are still using an old-style iostreams
library that is not in the std namespace.  There is a new, ISO-conformant
C++ library in the works, but it won't be out until GCC 3.0.

Also, please don't use HTML mail on the gcc list (and especially
don't send us MIME-encoded jpeg files!  They just clutter up the
archives).


> *********************************************************************
> 
> complextest.cpp:
> ---------------
> #include <iostream>
> 
> void main() {
>     std::cout << std::endl;
> }  
>  
> ********************************************************************* 

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