Here is the problem I have to do and I need some help to understand what going on with this compiler I used MS Visual C++ and it compiled OK!!
//Project:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
string name = "";
cout << "Type your first and last name:";
cin >> name;
cout << endl;
cout << name + " says, \"Hello World\"" << endl;
cout <<endl;
cout << "Press any key and <Enter> to continue ";
cin >>name >> name;
system("PAUSE");
return 0;
}
//Compile Log:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c main.cpp -o main.o
main.cpp:1:20: iostream: No such file or directory
main.cpp:3:18: string: No such file or directory
main.cpp: In function `int main(int, char**)':
main.cpp:8: `string' undeclared (first use this function)
main.cpp:8: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:8: parse error before `=' token
main.cpp:9: `cout' undeclared (first use this function)
main.cpp:10: `cin' undeclared (first use this function)
main.cpp:10: `name' undeclared (first use this function)
main.cpp:11: `endl' undeclared (first use this function)
make.exe: *** [main.o] Error 1
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the problem I have to do and I need some help to understand what going on with this compiler I used MS Visual C++ and it compiled OK!!
//Project:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
string name = "";
cout << "Type your first and last name:";
cin >> name;
cout << endl;
cout << name + " says, \"Hello World\"" << endl;
cout <<endl;
cout << "Press any key and <Enter> to continue ";
cin >>name >> name;
system("PAUSE");
return 0;
}
//Compile Log:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c main.cpp -o main.o
main.cpp:1:20: iostream: No such file or directory
main.cpp:3:18: string: No such file or directory
main.cpp: In function `int main(int, char**)':
main.cpp:8: `string' undeclared (first use this function)
main.cpp:8: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:8: parse error before `=' token
main.cpp:9: `cout' undeclared (first use this function)
main.cpp:10: `cin' undeclared (first use this function)
main.cpp:10: `name' undeclared (first use this function)
main.cpp:11: `endl' undeclared (first use this function)
make.exe: *** [main.o] Error 1
Execution terminated
Have you told the compiler where the include is?
Check this link out:
http://sourceforge.net/forum/message.php?msg_id=1789739
Wayne