Guest murl Posted October 6, 2002 Report Share Posted October 6, 2002 Hi all... I just installed mdk 9.0, and tried to compile some simple c++ code: [jon@brainfart jon]$ cat temp.cpp #include <string> using namespace std; int main(void){ string joe; joe = "hi"; std::cout << joe << std::endl; } When I try to compile, I get this error: [jon@brainfart jon]$ g++ temp.cpp temp.cpp: In function `int main()': temp.cpp:9: `cout' undeclared in namespace `std' temp.cpp:9: `endl' undeclared in namespace `std' WTF is going on? Am I missing something? I installed pretty much all the development libs, so I dont know what I'm missing. Thanks! Quote Link to comment Share on other sites More sharing options...
MoonChild Posted October 6, 2002 Report Share Posted October 6, 2002 You already said you will use the std namespace: using namespace std; Then in your cout statement, if you say: std::cout << joe << std::endl; What this translates to is: std::std::cout If I remember well at least... Haven't coded c++ for years. Quote Link to comment Share on other sites More sharing options...
Guest murl Posted October 6, 2002 Report Share Posted October 6, 2002 nahh, that's not the prob, that syntax is ok... It compiles fine on my redhat 7.1 box... I have no clue why it's doing this! Seems like there's a prob with where mdk installs gcc or something?? Quote Link to comment Share on other sites More sharing options...
DOlson Posted October 6, 2002 Report Share Posted October 6, 2002 Try including string.h instead of just string. Namespace std, last I checked, meant you didn't have to put the .h at the end... But then again, my teacher was Korean, so I couldn't understand her. Quote Link to comment Share on other sites More sharing options...
Guest christof Posted October 27, 2002 Report Share Posted October 27, 2002 I have the same problem when Compiling anything. But there again.. I am totally new to Linux... my box is running on Mandrake 9 too and I get the error messages: STD not found and gtk not found. the prolem is: I did install all teh development packages available on Mandrake... :-/ Quote Link to comment Share on other sites More sharing options...
MoonChild Posted October 27, 2002 Report Share Posted October 27, 2002 >/lib/cpp link is b0rken..do ln -sf /etc/alternatives/cpp /lib/cpp to fix.. Wow, Taras!!! THAT WAS THE BUG we found that made my WindowMaker's menu not to work! After manually creating that link, WindowMaker was up and running again! From the OSNews review of MDK9 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.