strings: compiles in scite&g++ but not in visual studios?

MrWizard6600

Supreme [H]ardness
Joined
Jan 15, 2006
Messages
5,791
troublesinstrings.jpg


again it compiles/links just fine under scitech and g++ at my college, but here its not coopertating.

cstdlib is included.

anythoughts?
 
well, i dont have a definitive answer for you, but looking at MSDN: string :: operator== examples you may have to use == against string, not against constants.

That is, something like:
Code:
string HELP = "help";
if (u_picked_spot==HELP){
}

This may not work, because i dont do stl programming.... i just use the msdn library for a reference
 
It is legal to use std::string's operator == against a string literal. I think the problem for the original poster is that they're building their Visual Studio app for Unicode rather than ANSI.
 
hah, as it turns out it was just a library issue. #include <string> at the top solved everything... sorry for wasting your time, I thought that was included in cstdlib. My mistake.
 
cstdlib is equivalent to stdlib.h, which is a pre-C++ C library. This is why you post full sources when asking for help ;) I was puzzling over this and gave up assuming it was my lack of experience with Microsoft's compiler.
 
Back
Top