I was frustrated with external libraries in C/C++ for a very very long time. I even stopped working with C/C++ at a point. Just finished this video, now I can build, link and install any external libraries or open source tools out there in the internet. I finally understand whats going under the hood. Thank you soo much!!!!
literally goated. I've been trying to find a normal humanized explanation on how to link libraries in different places for the past 3 HOURS with no success with no luck until I got to your video!
I started building a large BASH program last month, and the harder it gets to manage, the more I'm starting to want to use C++ instead. In you come just a few weeks before with the exact tutorial that I needed to convert all my shell scripts to a structured cpp project. Thanks a lot!
Thank you for your invaluable lecture. I learned a great deal from this video. To capture the return value, try printing it using the command "echo $?".
Given that in this example we are building the library and the executable adding a add_subdirectory() function to the parent CMakeLists.txt file will chain the projects. Then building the executable will build the library as well
Yes modules are load runtime, this is how Linux load device drivers which are shared library but module type. Module are build differently from normal user programs since they run with privilege and also in the kernel.
Thanks for your time to teach people something. Just a little feedback: In the previous video, you were using VS Code and I think it was easier to understand the file hierarchy. Also, not seeing the current directory in the command line prompt confuses things for us :)
Please "sudo apt install tree" and run the tree command from time to time. It'll make it easier for us to see the file structure, but thanks for the vid.
-f shouldn't be needed on rm -R. It doesn't do what some people assume it does, and what it does do is hide some error messages that may indicate you made a mistake typing the command. If the files you are deleting exist and your user has permissions on both the files and their containing directories, rm -R (or just rm -r) should work fine
Im a total newb in cmake and thanks for the video. I have some questions. 1. 00:26:56 In my case this didn't work and cmake gives me an error like this: /usr/bin/ld: cannot find -lmearlymath. So I erased target_link_directories(testsome PRIVATE ${CMAKE_SOURCE_DIR}/../../SomeLibDemo/cpp/build/) and replaced target link lib with target_link_libraries(testsome ${CMAKE_SOURCE_DIR}/../../SomeLibDemo/cpp/build/libmealymath.a) and this worked. Why is that /usr/bin/ld: cannot find -lmearlymath error popuping? 2. 00:33:30 my workspace shows up with this cmake error: install TARGETS given unknown argument "include". I get the meaning of DESTINATION and PUBLIC_HEADER from the offical docs, but what is lib and include?
my man the info is useful and I'm glad that people enjoy learning a lot but please get to the point lmao. I just want to learn how to create a library and link it to a project in cmake, I don't need to hear a whole tangent on namespaces
I really don't like the cmake thing , still can't compile a simple project . cmake also need the so file start with `lib`. And there are so many similar command make people confused. I really hope rust and cargo replace all those cmake and cpp things
I suggest adopting "Solve one problem Well", by sticking with talking about cmake. No Linux-commands, no C/C++. it's a better way to keep it short. Returned value from a command: echo $?.. Try 'false;echo $?;true;echo $?' You really shouldn't create confusion about which folder you are in. Let the prompt show!
Have you tested your project with CMake 2.8? No. So stop claiming it's the required version and use something current. Then you won't have to worry about bumping the minimum required version each time you want to use a feature.
5:18 that's kinda misleading and wrong, you don't need 2 hundred lines of Makefile to compile a programme, most of the stuff cmake puts into makefile are not useful for simple projects and moreover are a bloat imo
CMake generated Makefiles are artificially long - you could typically throw out more than 90% of its content. A handwritten Makefile for such a simple example would also only consist of a few lines. Thing is that handwritten Makefiles require you to specify all the dependencies and get all commands right for e.g. building a library. What I don't like about cmake: there is a lot of black magic happening behind the scenes. This discomfits me. Same is true for GUI vs command line.
A hammer doesn't tell you how a nail works, neither does CMake(or other build systems) tell you how the C++ building process works. C++ is just a forever-mess. CMake helps to ease that mess by abstracting away whatever specific functionally-equivalent syntactical idiosyncrasies your theoretical build system contains. I see CMake, and tools like it, as necessary evils in the hellscape that is the land of decentralized implementations of languages and their tools, ie the C++ ecosystem.
I'm sorry, this tutorial is too "all over the place" i.e. not concise. The crucial aspects could have been covered in 10m - 15m. Video quality is low, even at 1080p (doesn't seem sharp), and the text editor is way too small. Learning C++ tricks is not the topic, tutorials should be focused.
Came to learn about CMake, and I ended up learning all the c++ basics I've been missing my entire life.
Thanks, mate.
I was frustrated with external libraries in C/C++ for a very very long time. I even stopped working with C/C++ at a point. Just finished this video, now I can build, link and install any external libraries or open source tools out there in the internet. I finally understand whats going under the hood. Thank you soo much!!!!
As someone who has been trying to learn about CMake, this tutorial series is super helpful and criminally underrated. Thanks!
++
Thanks++
literally goated.
I've been trying to find a normal humanized explanation on how to link libraries in different places for the past 3 HOURS with no success with no luck until I got to your video!
I think you can return the exit value of the main function by typing echo $? on linux at 27:34
SEE ORIGINAL EPISODE 2, in episode 3 you would need what you see in original episode 2
Literally the best hands on tutorial on CMake you will ever find.
Thank you! I've been avoiding C/C++ very long time because of build system complexity. You make it clear.
Taught me everything I need about CMake, the best and the most practical tutorial there is. Thank you so much, you've gained a happy subscriber
I started building a large BASH program last month, and the harder it gets to manage, the more I'm starting to want to use C++ instead. In you come just a few weeks before with the exact tutorial that I needed to convert all my shell scripts to a structured cpp project. Thanks a lot!
Made my first installable c++ programme today. Thanks to you. I've been learning make and cmake lately.
Thank you for your invaluable lecture. I learned a great deal from this video. To capture the return value, try printing it using the command "echo $?".
17:24 also add adder.h in add_library(mearlymath adder.cpp adder.h) // those who are getting errors
Hi, 27:47
echo $?
to get the last return value.
Thanks!
Given that in this example we are building the library and the executable adding a add_subdirectory() function to the parent CMakeLists.txt file will chain the projects. Then building the executable will build the library as well
Yes modules are load runtime, this is how Linux load device drivers which are shared library but module type. Module are build differently from normal user programs since they run with privilege and also in the kernel.
Thanks for your time to teach people something.
Just a little feedback: In the previous video, you were using VS Code and I think it was easier to understand the file hierarchy. Also, not seeing the current directory in the command line prompt confuses things for us :)
Idk why but the tone you have makes me more focused. Thanks
Please "sudo apt install tree" and run the tree command from time to time. It'll make it easier for us to see the file structure, but thanks for the vid.
Very useful. Thanks a lot for taking the time to record and share this!
what the hell, these tutorials are just fire
Thank you very much for this brilliant series! I found it very helpful. Great job done! Keep rocking!
Love your videos, and really digging your logo!
Btw, you made the include file available but you did not change the include directive, its still using a relative path
you did not remove the relative path inclusion of adder.h in main.cpp, instead you could have add
#include
using namespace mearlymath;
I like almost any content you create for us
echo $? for getting the exit status of program. Thanks for the tutorial.
-f shouldn't be needed on rm -R. It doesn't do what some people assume it does, and what it does do is hide some error messages that may indicate you made a mistake typing the command. If the files you are deleting exist and your user has permissions on both the files and their containing directories, rm -R (or just rm -r) should work fine
Im a total newb in cmake and thanks for the video. I have some questions.
1. 00:26:56 In my case this didn't work and cmake gives me an error like this: /usr/bin/ld: cannot find -lmearlymath. So I erased target_link_directories(testsome PRIVATE ${CMAKE_SOURCE_DIR}/../../SomeLibDemo/cpp/build/)
and replaced target link lib with
target_link_libraries(testsome ${CMAKE_SOURCE_DIR}/../../SomeLibDemo/cpp/build/libmealymath.a)
and this worked. Why is that /usr/bin/ld: cannot find -lmearlymath error popuping?
2. 00:33:30 my workspace shows up with this cmake error:
install TARGETS given unknown argument "include".
I get the meaning of DESTINATION and PUBLIC_HEADER from the offical docs, but what is lib and include?
I had same issue. It was because i ran "make" instead of "sudo make install"
27:50 "echo $?" or "echo $status" for csh
Well it's fundamentally wrong what he is doing. The return value of a program indicates the status (negative values => not successful).
echo $? will show 5
This is awesome stuff dude. Just exactly what I needed to learn right now.
Does it mean that you dont need to set compiler flags for the linker to link your libary correctly?
These tutorials are great! Thanks for making them!
my man the info is useful and I'm glad that people enjoy learning a lot but please get to the point lmao. I just want to learn how to create a library and link it to a project in cmake, I don't need to hear a whole tangent on namespaces
Thanks for your knowledge!
Very good tutorial you earned another subscriber and a like ! Thank you zues
You could have used bash variable $? to get the return code of the compiled binary after it was executed :) Anyways great tutorial
Here to stomp the comp... 💯
where can we find trimerdemo and trim file
Really great contents! Thanks for creating this video
unable to do same things in cmake 3.10.2
I really don't like the cmake thing , still can't compile a simple project . cmake also need the so file start with `lib`. And there are so many similar command make people confused. I really hope rust and cargo replace all those cmake and cpp things
I suggest adopting "Solve one problem Well", by sticking with talking about cmake. No Linux-commands, no C/C++. it's a better way to keep it short.
Returned value from a command: echo $?.. Try 'false;echo $?;true;echo $?'
You really shouldn't create confusion about which folder you are in. Let the prompt show!
Amazing, maybe a little bit of zoom on the code, content stays perfect :] Thank you
9:00 at the drop of a dime.
Haha. I'm going to use that one.
Thank you!!!
I fucking love you .. thank you man
If you say definition all the time than, eventually, you will be right 😅
Have you tested your project with CMake 2.8? No.
So stop claiming it's the required version and use something current. Then you won't have to worry about bumping the minimum required version each time you want to use a feature.
The original was easier to follow, you mix things that are linux usage related thats not too important for cmake
Thanks!
5:18 that's kinda misleading and wrong, you don't need 2 hundred lines of Makefile to compile a programme, most of the stuff cmake puts into makefile are not useful for simple projects and moreover are a bloat imo
Please please - this music overlay is execively annoying!
Thanks
Thanks alot
CMake generated Makefiles are artificially long - you could typically throw out more than 90% of its content. A handwritten Makefile for such a simple example would also only consist of a few lines.
Thing is that handwritten Makefiles require you to specify all the dependencies and get all commands right for e.g. building a library.
What I don't like about cmake: there is a lot of black magic happening behind the scenes. This discomfits me. Same is true for GUI vs command line.
A hammer doesn't tell you how a nail works, neither does CMake(or other build systems) tell you how the C++ building process works. C++ is just a forever-mess. CMake helps to ease that mess by abstracting away whatever specific functionally-equivalent syntactical idiosyncrasies your theoretical build system contains. I see CMake, and tools like it, as necessary evils in the hellscape that is the land of decentralized implementations of languages and their tools, ie the C++ ecosystem.
I'm sorry, this tutorial is too "all over the place" i.e. not concise. The crucial aspects could have been covered in 10m - 15m. Video quality is low, even at 1080p (doesn't seem sharp), and the text editor is way too small. Learning C++ tricks is not the topic, tutorials should be focused.
ya just have no clue what cmake really is …. 🤦♂️🤦♂️🤦♂️🤦♂️🤦♂️🤦♂️
🤓
31:53 that POV killed me
Thanks