Welcome! Log In Create A New Profile

Advanced

Cant include c++ std::string lib

Posted by SteelSLasher 
Cant include c++ std::string lib
July 08, 2009 11:50AM
I need a few functions from std::string which arent in the cstring lib. I thought that like normal c++ i would do
#include

but this led to a not found error so i changed it to
#include

which worked perfectly but when then the compiler gives me this error
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'

The error points to
using namespace std;
Re: Cant include c++ std::string lib
July 08, 2009 03:19PM
I think you've named your file with .c-suffix and you're using the default makefile.
Try to rename your file to end with .cpp-suffix, because makefile compiles only them with c++-compiler (If I remember right)

Then you should also be able to use normal includes
Re: Cant include c++ std::string lib
July 08, 2009 07:33PM
Quote
Dande
I think you've named your file with .c-suffix and you're using the default makefile.
Try to rename your file to end with .cpp-suffix, because makefile compiles only them with c++-compiler (If I remember right)

Then you should also be able to use normal includes

Yeah i should have checked that since this file is a C file where all other files were c++ so its one of things that were hard to notice, thanks for pointing it out
Sorry, only registered users may post in this forum.

Click here to login