Problems getting g++ to run
LLeweLLyn Reese
llewelly@lifesupport.shutdown.com
Thu Mar 6 00:00:00 GMT 2003
"Karl Gangle" <kgangle72@attbi.com> writes:
> Hi,
>
> I am trying to compile a c++ program using g++ in Linux. The program is
>
> #include <iostream>
> #include <string>
using std::cout;
using std::endl;
using std::string;
>
> int main() {
>
> string s1( "string1" );
>
> cout << s1 << endl;
>
> return 1;
> }
>
>
> The compiler errors indicate that string, cout, endl, and s1 are not
> defined.
They are not part of standard C++. You are looking for std::cout,
and std::string, std::endl.
> I think the problem is that the include files are not found. So,
> what needs to be done for g++ to find the include file? What environment
> variables along with there value need to be set?
> What needs to be done to set library environment variable values?
>
> If there are any other things that need to be done to get g++ to work please
> let me know.
Now I wish gcc 3.x would say something akin to: 'cout' not
defined. (Perhaps you need a using directive such as 'using std::cout'
or explicit qualification?). Of course that kind of warning would
require each unrecognized name to be looked up a second time ...
More information about the Gcc-help
mailing list