>can't even get a c++ hello world script to compile
the code is the one from stroustrup's textbook which to my horror doesn't give any help for linux users#include "std_lib_facilities.h"
int main()
{
cout<<"Hello, World!\n";
return 0;
}
the error ishelloworld.cpp:(.text+0x3d): undefined reference to `std::ios_base::Init::Init()'
helloworld.cpp:(.text+0x4c): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
>>60291466
How did you compile it
>>60291475
gcc helloworld.cpp
>>60291466
>>60291478
You should use g++.
Either include std or std::
>>60291508
using std*
>>60291488
Thanks anon. Do you know how to set the output file's name in the command?
>>60291552
This is a question that is answered by the first screen page of gcc and g++'s man page.
Because I'm at lunch break, have the answer anyway:g++ -o helloworld helloworld.cpp
>>60291466
Put using namespace std; in front of main
>>60291649
That's already included in the textbook header.
http://stroustrup.com/Programming/PPP2code/std_lib_facilities.h