Jump to content

Mandrake 9.0 probs - g++ can't find std??


Guest murl
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
Guest christof

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... :-/

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...