Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Mingw C++ string is not a type ??

Credits go to X-G for helping out!
This thread is locked; no one can reply to it. rss feed Print
Mingw C++ string is not a type ??
Ariesnl
Member #2,902
November 2002
avatar

this goes fine: string strMystring;

this goes wrong: string GetTimeString();

error 'string' does not name a type ???

I'm using dev-C++

any idea's or a quick work around.. I want to go on with my game >:(

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Jonatan Hedborg
Member #4,886
July 2004
avatar

moar coad!

Ariesnl
Member #2,902
November 2002
avatar

???

call me stupid but I don't get it

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

IonBlade
Member #3,521
May 2003
avatar

You aren't naming the string...

Use:

string strMystring = GetTimeString();

//or
string strMystring(GetTimeString());

[EDIT]
If you're trying to define a function prototype, maybe you need to put the namespace in? I'm not sure why you would have to if you're already using strings fine, but I haven't used Dev C++ in awhile...

std::string GetTimeString();

------

"I've got to choose my words carefully so that I'm not misunderstood, but I think there are fewer developers around today who think about making a good game. As a creator, I find that sad..." - Hideo Kojima

LennyLen
Member #5,313
December 2004
avatar

more code

Ariesnl
Member #2,902
November 2002
avatar

no ! I want to make a function GetTime string() that returns a string...

string GetTimeString(); is just the declaration

h and cpp file added

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

IonBlade
Member #3,521
May 2003
avatar

I looked at engine.h, looks like you aren't including <string>

------

"I've got to choose my words carefully so that I'm not misunderstood, but I think there are fewer developers around today who think about making a good game. As a creator, I find that sad..." - Hideo Kojima

X-G
Member #856
December 2000
avatar

... you never actually include <string>, and you don't use the namespace. FAIL.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Ariesnl
Member #2,902
November 2002
avatar

I include <string> in engine.cpp before engine.h but not using namespace could be the problem..

[edit] that does the job !!!

thnx .. I need coffe I think ::);D

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

bamccaig
Member #7,536
July 2006
avatar

Ariesnl said:

I include <string> in engine.cpp before engine.h...

I think it would be more correct to include <string> in engine.h. **Shifty eyes**

Go to: