string library in gcc 3.0.3?
John Love-Jensen
eljay@adobe.com
Thu Feb 7 08:21:00 GMT 2002
Hi Ukrit,
Your program does not comply to ISO/IEC 14882:1998 "Standard C++
specification". That is to say: it's not C++.
I've touched it up for you...
test.cpp:
#include <string>
#include <cstdio>
using namespace std;
int main() {
string a;
a = "test";
printf("test message: %s", a.c_str());
// However, preferable over the printf():
// cout << "test message: " << a << endl;
// (You'd need #include <iostream>, too.)
}
I recommend Stroustrup's The C++ Programming Language (special edition, or
third edition).
--Eljay
More information about the Gcc-help
mailing list