Hello, I'm trying to compile a small test program I've written to A) see if I remember anything of c++, and B) get used to using gcc to compile. The program has 7 lines of code, which will ask for a name, and return it. here's the program:
#include <iostream>
#include <iostream.h>
//those two are there becasue I don't exactly know which header file I need to use.
main ()
{
string FirstName="";
string LastName="";
//initialized that way because if I don't do it that way, gcc returns a "FirstName not initialized in this scope" error.
cout<<"What is the first name?";
cin>>FirstName;
cout<<"What is the last name?";
cin>>LastName;
cout<<"The name is "<<Firstname<<" "<<Lastname;
return 0;
}
When I runn gcc with the -c option, it compiles fine. But then, when I take that object file, and try to compile it into a program using the -o option, I get a bunch of "Unreferenced something or other , std::cout" and "cin" errors. Any ideas what could be causing it? And I don't have a ready file with all the errors in it, if anyone could tell me how to send the errors to a file so I can read them later, it would be much appreciated.
#include <iostream>
#include <iostream.h>
//those two are there becasue I don't exactly know which header file I need to use.
main ()
{
string FirstName="";
string LastName="";
//initialized that way because if I don't do it that way, gcc returns a "FirstName not initialized in this scope" error.
cout<<"What is the first name?";
cin>>FirstName;
cout<<"What is the last name?";
cin>>LastName;
cout<<"The name is "<<Firstname<<" "<<Lastname;
return 0;
}
When I runn gcc with the -c option, it compiles fine. But then, when I take that object file, and try to compile it into a program using the -o option, I get a bunch of "Unreferenced something or other , std::cout" and "cin" errors. Any ideas what could be causing it? And I don't have a ready file with all the errors in it, if anyone could tell me how to send the errors to a file so I can read them later, it would be much appreciated.