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.
Learning C++
Moderators: raboof, MattKingUSA, khz
-
- Established Member
- Posts: 1161
- Joined: Mon Mar 09, 2015 3:09 pm
- Has thanked: 351 times
- Been thanked: 113 times
Re: Learning C++
Found something:
https://www.cplusplus.com/doc/tutorial/ ... structure/
So basically a C++ program starts with:
Bookmarked that page.
Next will probably be me watching that C++ course again, but this time me typing along in Kdevelop.
https://www.cplusplus.com/doc/tutorial/ ... structure/
So basically a C++ program starts with:
Code: Select all
#include <iostream>
using namespace std;
int main ()
Next will probably be me watching that C++ course again, but this time me typing along in Kdevelop.
-
- Established Member
- Posts: 1161
- Joined: Mon Mar 09, 2015 3:09 pm
- Has thanked: 351 times
- Been thanked: 113 times
Re: Learning C++
Stupid question time.
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++ ?
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++ ?
- 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++
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 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++ ?
-
- Established Member
- Posts: 1067
- Joined: Mon May 12, 2014 7:11 am
- Has thanked: 15 times
- Been thanked: 36 times
Re: Learning C++
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
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