Learning C++

Completely and utterly unrelated.

Moderators: raboof, MattKingUSA, khz

folderol
Established Member
Posts: 2083
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 232 times
Been thanked: 400 times
Contact:

Re: Learning C++

Post by folderol »

The first line tells you to include in a library file called iostream along with your code.
The second line is a sort of shortcut so that you and use a slightly abbreviated form.
Without it you would have to enter:
std::cout

the std bit refers to the standard library.
The Yoshimi guy {apparently now an 'elderly'}
Gps
Established Member
Posts: 1161
Joined: Mon Mar 09, 2015 3:09 pm
Has thanked: 351 times
Been thanked: 113 times

Re: Learning C++

Post by Gps »

Thank you :)
Gps
Established Member
Posts: 1161
Joined: Mon Mar 09, 2015 3:09 pm
Has thanked: 351 times
Been thanked: 113 times

Re: Learning C++

Post by Gps »

Found something:

https://www.cplusplus.com/doc/tutorial/ ... structure/

:)

So basically a C++ program starts with:

Code: Select all

#include <iostream>
using namespace std;

int main ()
Bookmarked that page.

Next will probably be me watching that C++ course again, but this time me typing along in Kdevelop.
Gps
Established Member
Posts: 1161
Joined: Mon Mar 09, 2015 3:09 pm
Has thanked: 351 times
Been thanked: 113 times

Re: Learning C++

Post by Gps »

Stupid question time. :P

I have been looking at the lmms code, but cant figure out how its all tied together.

Does cmake do this or am I missing something?

I suspect this is why C++ is called modular, but cant find out how those modules are combined. :?

Coming from basic, I was expecting one big file of all code, but this does not seem to be the case for C++ ?
User avatar
Michael Willis
Established Member
Posts: 1460
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 71 times
Been thanked: 169 times
Contact:

Re: Learning C++

Post by Michael Willis »

Gps wrote: Sun Apr 17, 2022 5:22 pm Coming from basic, I was expecting one big file of all code, but this does not seem to be the case for C++ ?
Yes, some kind of build utility is responsible for multi-file projects, which are very common as project size grows. In this case, cmake is the build utility, but be aware that other projects may use other build tools.
Gps
Established Member
Posts: 1161
Joined: Mon Mar 09, 2015 3:09 pm
Has thanked: 351 times
Been thanked: 113 times

Re: Learning C++

Post by Gps »

Thank you. :)
rghvdberg
Established Member
Posts: 1067
Joined: Mon May 12, 2014 7:11 am
Has thanked: 15 times
Been thanked: 36 times

Re: Learning C++

Post by rghvdberg »

Hardest thing with c++ , when you start totally from scratch, is building the god damned project. With libraries and linking.
And you can use build systems like Makefile, CMake, Meson or just do it on the command line .. sigh

anyway
I learned (a bit) of c++ by following the New Boston c++ playlist
https://www.youtube.com/watch?v=tvC1WCd ... 8440AA6B83
now this is a decade old, so maybe there are more up to date tutorials

an important and for me pretty hard to grab concept was/is pointers
imho the best explanation of all time is by mycodeschool, a legend ..
https://www.youtube.com/playlist?list=P ... 7pgGsasm2_

of course I read/browsed several books but I learned the most from
coding,
getting stuck,
getting mad,
search,
and the most important : ask for help

I learned a lot from the people in #lad on irc, the lmms discord is quite helpful too

I was a youngster when I learned to code in c++, the young age of 47 ;-)
Gps
Established Member
Posts: 1161
Joined: Mon Mar 09, 2015 3:09 pm
Has thanked: 351 times
Been thanked: 113 times

Re: Learning C++

Post by Gps »

Thank you, at least the getting mad part sounds very familiar. :lol:

That feeling I want to fine tune my pc with an axe.

I will study those links. :)
Post Reply