This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Simple string test program
- From: Tabakovic Arnes <arnes dot tabakovic at sbi dot ch>
- To: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Tue, 20 Aug 2002 11:32:54 +0200
- Subject: Simple string test program
Hi,
I am using the latest version of libstd++ and SGI stl to compile a small
program using gcc compiler. This program is shown below:
#if defined (__GNUG__) && defined (__sun__)
#define __SINST__
#endif
#include <fstream.h>
// c++ STL Headers
#include "../stl/string"
using namespace std;
int main(int argc, char **argv)
{
string s1 = "s1";
string s2 = "s2";
if (s1 != s2)
cout << "s1 not equal to s2!" << endl;
else
cout << "s1 is equal to s2!" << endl;
return 0;
}
I get the following error by compiling it with g++:
g++ -c -I../stl testString.cpp -o testString.o
In file included from ../stl/string:17,
from testString.cpp:8:
../stl/stl_config.h:562:1: warning: "__STL_VOLATILE" redefined
/usr/local/include/g++-v3/sparc-sun-solaris2.8/bits/c++config.h:77:1:
warning: this is the location of the previous definition
In file included from ../stl/string:18,
from testString.cpp:8:
../stl/stl_string_fwd.h:24: parse error before `>' token
../stl/stl_string_fwd.h:27: syntax error before `;' token
../stl/stl_string_fwd.h:28: syntax error before `;' token
../stl/stl_string_fwd.h:30: parse error before `&' token
../stl/stl_string_fwd.h:30: confused by earlier errors, bailing out
make: *** [testString.o] Error 1
Can anybody help please? By advance, I thank you!
Arnes.