Help calling function from library.

hmm, I'm having a bit of trouble calling my function in main to test it out..

OgreWeaponStrikes::OgreSwordStrikes::OgreRanSwordStrikesBtl(1,50,22,std::string "a monster");

error

C:\Users\Jeremy\Documents\C++\C++ Tutorials\OgrenTitanium\main.cpp|8|error: expected primary-expression before string constant|


I remember learning about classes, and creating objects. I did this successfully with a simple class. I never tried from a namespace before. Not sure what to do, lol.

Last edited on
I think you mean

OgreWeaponStrikes::OgreSwordStrikes::OgreRanSwordStrikesBtl(1,50,22,std::string("a monster") );

so you construct a std::string containing "a monster" to pass to OgreRanSwordStrikesBtl?

But you don't actually need to explicitly construct a std::string from a string literal; the compiler will do this for you automatically if you use just the string literal.

OgreWeaponStrikes::OgreSwordStrikes::OgreRanSwordStrikesBtl(1,50,22,"a monster");

Andy

Last edited on
Topic archived. No new replies allowed.