LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   #include<string> not working (https://www.linuxquestions.org/questions/linux-software-2/include-string-not-working-162806/)

dtjohnst 03-26-2004 07:35 PM

#include<string> not working
 
Ok. I have Slackware 9.1, and I'm trying to install a program that I need for school. Only having a minor problem, and I tested it and isolated it down to this:

#include<string>

isn't actually #including anything when compiled with gcc. It doesn't give that as an error, but ANYWHERE I try to define a string as in:

Code:

string someStringHere;
Does anyone know where my string library is, or how to set it up so it gets included properly?

Komakino 03-26-2004 07:52 PM

I bet you're not including the line:
Code:

using namespace std;
just after your include statements. Either add that line or every time you declare a string, refer to it as:
Code:

std::string
so you end up with variable declarations like:
Code:

std::string mystring;

void stringfunction(std::string aVariable, int anInt){
      std::cout << aVariable << std::endl;
}


dtjohnst 03-26-2004 08:00 PM

Re: #include<string> not working
 
lol Yeah, that would be a newbie mistake, but using namespace std is in there. It'll actually be a massive pain if I can't just figure out why it's giving me these errors, seeing as the root of the problem is that I'm installing something. There's about 300 files being compiled by this weird series of makefiles. It's pretty messy, I sure didn't code it. I'd hate to have to go edit each of these files...but yeah, using namespace std is there. Any other ideas?


All times are GMT -5. The time now is 04:34 PM.