gcc with iostream problem
Hi All,
Just started on linux and like to write some c++ programs, but in the very beginning I was stopped on something simple I think: #include <iostream.h> int main() { cout<<"test"; } when I use gcc test.cpp , I'm getting error: "undefine reference to std::cout" On windows I don't have problems with that. thanks |
(disclaimer: I AM NOT A PROGRAMMER!)
vi bob.C [type in the bob program] :wq g++ -Wno-deprecated bob.C -o bob ./bob |
That's a linker error mate ...
Could you please copy & paste exactly what you did to get there, a description of you distro and the gcc version would be nice to know, too .. :) Cheers, Tink |
macewan,
thanks, it works now, but why gcc doesn't want? I can use g++, but I thought that gcc is c++ compiler. thanks! |
Read man gcc :) and find out that you thought
wrong... Cheers, Tink |
Quote:
|
Quote:
g++ is a program that invokes gcc with the default language set to C++ and automatically links to c++ libraries |
cant you specify a language for gcc to compile with the -x option?
|
#include <iostream.h>
int main() { cout << "test"; return 0; } /////////////////////// i have to return 0 in the case above. |
Quote:
-x language Specify explicitly the language for the following input files (rather than choosing a default based on the file name suffix) . This option applies to all following input files until the next `-x' op- tion. Possible values of language are `c', `objec- tive-c', `c-header', `c++', `cpp-output', `assem- bler', and `assembler-with-cpp'. Cheers, Tink |
All times are GMT -5. The time now is 04:34 PM. |