got a compile error
Posted: Tue Oct 20, 2009 7:44 pm
i got this compile error but im not sure why
here is the error im getting
C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp In function `int main(int, char**)':
6 C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp `mystring' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
7 C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp `cout' undeclared (first use this function)
7 C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp `endl' undeclared (first use this function)
C:\Documents and Settings\Administrator\Desktop\C++ stuff\Makefile.win [Build Error] [main.o] Error 1
im not sure whats wrong with this... please help thank you
Code: Select all
#include <iostream>
#include <stdlib.h>
#include <string>
int main(int argc, char *argv[])
{
string mystring;
mystring = "abcdef";
cout << mystring[2] << endl;
return 0;
}
C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp In function `int main(int, char**)':
6 C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp `mystring' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
7 C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp `cout' undeclared (first use this function)
7 C:\Documents and Settings\Administrator\Desktop\C++ stuff\main.cpp `endl' undeclared (first use this function)
C:\Documents and Settings\Administrator\Desktop\C++ stuff\Makefile.win [Build Error] [main.o] Error 1
im not sure whats wrong with this... please help thank you