ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi, I'm quite a newbie, and I have a problem with gcc: I tried to compile a simple hello world like program, I have inluded iostream, and the compiler seems to have no problem with that (if I put iostream.h it warns me that the header is deprecated/antiquated) but it tells me cout isn't defined... how can that happen? Any suggestions?
already tried that; g++ gives me just the same problem, I have none of the lines you mentioned in my program, gonna try now
Edit: using namespace std gives me a load of errors and warnings, while using std::cout removes that error and leaves me with only endl undefined
Edit2:tried removing endl, it tells me of lots of undefined references to std::ios_base::init in function _static_inizialization_and_destruction_0
and of more undefined references to std::cout, to std::basic_ostream<char,and to _gxx_personality_v0
If you put "using namespace std;" under the include directive, what kind of warnings and errors are you getting? It should work ok. What exactly is the command you're using to compile?
I'm simply using gcc filename.cpp, the errors I get are just the same I get with writing using std::cout and using std::endl; it seems I do NOT have iostream in the usr/include folder... and that might just be the problem, still, I tried compiling the same code on another machine with those libraries and... it still doesn't work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.