User forums > Using Code::Blocks
Possible to use string without string library
(1/1)
Kayle:
Hello,
I've discover code::blocks today and I'm very surprising by this very good IDE.
Unfortunately, I've a problem with the iostream and string libraries. During a test, I've seen that I've the possibility to use a string without make an include of <string>. In others terms, the code below works instead invoke an error:
--- Code: ---#include <iostream>
int main(){
std::string s1 = "C::B is the best.";
std::cout << s1 << std::endl;
return 0;
}
--- End code ---
How is it possible and how can I avoid this? Because on VS2008 I've and error if I try to do that...
Sorry for my english, I'm french.
Thanks
Jenna:
Not related to C::B and therefore vioalting our forum rules.
Such a thread normally gets locked, so be warned.
Be aware C::b is "just" an IDE not a compiler.
Nevertheless:
iostream includes ostream,
ostream includes ios,
ios includes iosfwd,
iosfwd includes bits/stringfwd.h,
bits/stringfwd.h defines string in namespace std
that's the way gcc (at least 4.4) does it, Microsoft, Borland etc. compilers might do it in a different way.
Navigation
[0] Message Index
Go to full version