[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>can't even get a c++ hello world script to compile the

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 10
Thread images: 2

File: hurghhllgh hrughl.png (182KB, 481x511px) Image search: [Google]
hurghhllgh hrughl.png
182KB, 481x511px
>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 is
helloworld.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*
>>
File: wojak silvia.png (527KB, 732x426px) Image search: [Google]
wojak silvia.png
527KB, 732x426px
>>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
Thread posts: 10
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.