What's The Hardest Part About Learning C++? - /g/ (#106014601) [Archived: 293 hours ago]

Anonymous
7/25/2025, 1:55:04 AM No.106014601
hard
hard
md5: 02f7ddfedf0c979d0e3ed13c135320e9๐Ÿ”
I'm so close to tapping out anons. Java dev here learning C++, i thought it would be a cakewalk because the syntax is similar, but all of these const parameters with & symbols, is all so confusing. What else is in store for me as a get further along?
Replies: >>106014621 >>106014651 >>106014660 >>106014679 >>106014889 >>106014935 >>106014950 >>106015053 >>106015293 >>106018178 >>106018246 >>106018841 >>106020731 >>106021662 >>106024770 >>106026790 >>106029032
Anonymous
7/25/2025, 1:57:30 AM No.106014619
If your asshole (brain) can handle a 24oz can of malt liquor (java) why can't it handle a white claw (C++)?
Replies: >>106014725
Anonymous
7/25/2025, 1:58:03 AM No.106014621
>>106014601 (OP)
You're fucked. The codebases that use C++ are usually even more of a retarded clusterfuck than the language itself.
Anonymous
7/25/2025, 2:03:42 AM No.106014651
>>106014601 (OP)
>const parameters with & symbols.
Those are the least of your concerns.
Anonymous
7/25/2025, 2:04:37 AM No.106014660
>>106014601 (OP)
The syntax. Not as retarded as rust, but up there
Replies: >>106026816
Anonymous
7/25/2025, 2:07:32 AM No.106014679
IMG_20250601_182325_344
IMG_20250601_182325_344
md5: 8245ba6c00d221e11e627094eac9a031๐Ÿ”
>>106014601 (OP)
& means a reference, const means you can't change what you are referencing. What is so difficult about that?
Replies: >>106018173
Anonymous
7/25/2025, 2:14:13 AM No.106014725
>>106014619
All of these rules about constsants are so confusing. Do I really have to do it for every string?
Replies: >>106018590
Anonymous
7/25/2025, 2:35:00 AM No.106014889
>>106014601 (OP)
the hardest part about learning C++ is learning how to use CMake dear god why why do i have to learn a second language just to be able to build my projects fuck
Replies: >>106014909 >>106014921 >>106015891 >>106016927 >>106020503 >>106022238
Anonymous
7/25/2025, 2:37:24 AM No.106014909
>>106014889
Sad isn't I. Now if only someone could write a building language of xpressed as C++ instead of yet another declarative language.
Anonymous
7/25/2025, 2:38:32 AM No.106014921
>>106014889
>why why do i have to learn a second language just to be able to build my projects
It's even worse than that. Cmake is a build system with builds another build system, and that built build system is what actually builds your code. Sometimes you have to learn the language of the build system CMake is building to debug issues.
Anonymous
7/25/2025, 2:40:10 AM No.106014935
>>106014601 (OP)
the hardest part about learning c++ is learning to trick yourself into thinking "it's fine if it only builds on my machine" "it's fine if building my project takes more than 1 step" "it's fine if entirely preventable memory management issues plague my software, humans never make mistakes, it's just a skill issue"
so yeah it's a steep learning curve
Replies: >>106028345
Anonymous
7/25/2025, 2:42:14 AM No.106014950
>>106014601 (OP)
The hardest part of C++ is dependency management.

Specially when you want to statically link everything and you also building cross platform stuff
Replies: >>106015067 >>106029032
Anonymous
7/25/2025, 2:58:16 AM No.106015053
>>106014601 (OP)
>java
topkek
if you don't know C you will never get C++
Anonymous
7/25/2025, 3:00:51 AM No.106015067
>>106014950
>Specially when you want to statically link everything and you also building cross platform stuff
this is mostly microsoft and apple's fault for having retarded tools that things like CMake have to account for separately
all the complexity when it comes to cross platform is because of microsoft and apple, not c++ or cmake
Replies: >>106018560
Anonymous
7/25/2025, 3:10:38 AM No.106015141
I just avoid the hard parts completely.
I write C++ like C with some QoL improvements.
Replies: >>106018211 >>106019892
Anonymous
7/25/2025, 3:25:43 AM No.106015293
>>106014601 (OP)
Meh, write C# first, specially stuff that need you do shit with p/invoke, then fuck around with unsafe C# as that basically is retarded C++ and then jump to C++. Meanwhile unless you have done some JNI boilerplate stuff, java helps you fuck all with C++.
Replies: >>106016778
Anonymous
7/25/2025, 4:18:52 AM No.106015760
I have been working through learncpp and doing the excercises.
Anonymous
7/25/2025, 4:28:06 AM No.106015818
Overcoming your own mental retardation, because only a retard would use C++ and not just C.
Anonymous
7/25/2025, 4:37:18 AM No.106015891
>>106014889
Why are you using cmake in the first place? Use your shell. If you need incremental builds (you don't) use make.
Replies: >>106020250
Anonymous
7/25/2025, 6:47:49 AM No.106016778
>>106015293
This is good advice.
Anonymous
7/25/2025, 7:19:55 AM No.106016927
>>106014889
after dealing with msbuild its alright. fuck gui tools.
Anonymous
7/25/2025, 11:37:22 AM No.106018173
>>106014679
&& - still trying to wrap my head around that.
Replies: >>106022105
Anonymous
7/25/2025, 11:38:23 AM No.106018178
>>106014601 (OP)
>What's The Hardest Part About Learning C++?
CMake
Replies: >>106022412
Anonymous
7/25/2025, 11:47:04 AM No.106018211
>>106015141
>qol improvements

really not an argument. and i like both. not only that, but microsofts cucking of c++ with their own compilers invites even more complexity.
Replies: >>106018236
Anonymous
7/25/2025, 11:53:01 AM No.106018236
>>106018211
>microsofts cucking of c++ with their own compilers
how did they cuck C++?
Replies: >>106018538 >>106018596
Anonymous
7/25/2025, 11:54:44 AM No.106018246
>>106014601 (OP)
One argument is that C++ is huge and has lots of obsolete features, especially due to backwards compatibility, and that there is little guidance as to which features are considered deprecated, and which features are considered modern, making learning more difficult.
One variant of the proposed profiles feature, namely a sort of "modern" profile, might be able to mitigate that issue, and I believe enabling profiles to support that could very well be worth it.
Anonymous
7/25/2025, 12:51:00 PM No.106018538
>>106018236
I haven't played with them yet, but modules. Also microsoft's compilers don't always work very well but are widely used, so its limits effectively become language specifications.
Replies: >>106018607 >>106019906
Anonymous
7/25/2025, 12:54:22 PM No.106018560
>>106015067
Sounds like C++ problem for not specifying a standard for these things...
Replies: >>106018608
Anonymous
7/25/2025, 12:58:23 PM No.106018590
>>106014725
Yes or you suffer suboptimal code gen instead.
This is why most new languages choose const by default.
Anonymous
7/25/2025, 12:58:47 PM No.106018596
>>106018236
MS C++ compiler from waaaay back in the 90s always had limitations with their own flawed interpretation of template partial specialisations and with peculiarities with templates generally. So to keep cross platform compatibility, you couldn't use the more advanced features of C++ templates implemented in GCC of that time (the EGCS project had all the coolest advanced template implementations ahead of GCC itself).
Replies: >>106018634
Anonymous
7/25/2025, 1:00:34 PM No.106018607
>>106018538
>modules
I also haven't touched them yet, but apparently MSVC has the most complete support for modules atm. for me, the biggest drawback was shitty support for them in CMake, but it was a long time since I last checked. I may give them a try once again.
>Also microsoft's compilers don't always work very well but are widely used
sort of agree. I found more bugs in MSVC than in gcc and clang. the good thing about MS is that they are pretty quick to fix them after placing a report.
Replies: >>106019906
Anonymous
7/25/2025, 1:00:46 PM No.106018608
>>106018560
Much like Make for C and Ant/gradle/maven for java
Anonymous
7/25/2025, 1:05:37 PM No.106018634
>>106018596
>waaaay back in the 90s
well, I guess at this point those are just interesting war stories. today MSVC is pretty decent. if anything, it pisses me off that isn't strict enough when it comes certain template constructs. sometimes it allows things that later break my gcc and clang builds.
Anonymous
7/25/2025, 1:38:40 PM No.106018841
>>106014601 (OP)
Programming isn't a language.
Anonymous
7/25/2025, 4:08:24 PM No.106019892
>>106015141
go back to go or whatever new jeetlang is popular among cnilejeets
Anonymous
7/25/2025, 4:10:16 PM No.106019906
>>106018538
>>106018607
use clang, it has pretty good modules support
Anonymous
7/25/2025, 4:58:07 PM No.106020250
>>106015891
You do if you're making a game
Anonymous
7/25/2025, 5:24:48 PM No.106020503
>>106014889
I just finished learning cmake, it is indeed retarded. Why can't they use json or xml ?
Replies: >>106022993
Anonymous
7/25/2025, 5:45:55 PM No.106020731
>>106014601 (OP)
Dealing with cmake faggotry.
Anonymous
7/25/2025, 7:13:27 PM No.106021662
>>106014601 (OP)
just learn C# instead, you learn the wrong language first to jump into C++
Anonymous
7/25/2025, 7:24:11 PM No.106021789
>CMake
it is not even a C++Make
Anonymous
7/25/2025, 7:48:47 PM No.106022105
>>106018173
outside of templates, it's a function which only accepts rvalues, which is either a temporary value you make or a value you "move". in templates, it's known as a "universal" reference which helps forward value types or something i forget what. read "effective modern c++" which at this point is neither modern or effective but still helpful
Anonymous
7/25/2025, 7:57:25 PM No.106022238
Visual_Studio_Icon_2022.svg
Visual_Studio_Icon_2022.svg
md5: d80916018c94bab6c29dbbd3fc3ccd67๐Ÿ”
>>106014889
why not just use visual studio?
Replies: >>106023248
Anonymous
7/25/2025, 8:08:11 PM No.106022412
>>106018178
It's way easier than gradle or maven or whatever python devs use these days.

At least with cmake, you can pull a dependency from 20 years ago and it'll still work, with java, you'll be lucky if the maven repo still exists and hasn't updated to a version that breaks the project's workflow
Anonymous
7/25/2025, 8:41:15 PM No.106022993
>>106020503
if you believe that, then you've not learned cmake. Cmake is a whole programming language. Everyone seethes at cmake because they've never had to use other build systems. It is inherently hard to build c++ because you'll need to build dependencies from source which will require interop with their build system, this is something cmake does well.
Replies: >>106023556
Anonymous
7/25/2025, 8:59:28 PM No.106023248
>>106022238
because it only works on windows and only compiles for windows
Replies: >>106030412
Anonymous
7/25/2025, 9:20:16 PM No.106023556
>>106022993
it's not hard. add_library(static, target_include_directories( public, target_include_directories(public, add_executable, target_link_libraries... how hard can that be to learn?
Replies: >>106023722
Anonymous
7/25/2025, 9:32:47 PM No.106023722
>>106023556
it gets hard when you need to actually ensure these libraries are installed to the correct version. If you statically link everything then you won't have to worry, except pull tar.gz from ftp servers and building git submodules. but once you need to do some target specific logic, need to make your project multi compiler compatible, then it gets really messy. If you look at any large C++ projects they often have dozens of CMakeLists
Replies: >>106024081
Anonymous
7/25/2025, 9:54:44 PM No.106024081
>>106023722
Do you have any examples of these projects?
Replies: >>106024242
Anonymous
7/25/2025, 10:05:28 PM No.106024242
>>106024081
check out drogon, it's pretty popular for making web services in c++. note that it mostly focuses on building for linux and it's a cli.
Anonymous
7/25/2025, 10:34:32 PM No.106024770
>>106014601 (OP)
C++ is a gigantic black hole and I could never figure out if I was doing anything correctly despite my code working just fine. Should I use this or that from the standard library? Am I doing this in the right C++XX way? Do I really have to use OOP?
Replies: >>106027485
Anonymous
7/25/2025, 11:20:33 PM No.106025756
1722995738308378
1722995738308378
md5: 0889d9b9c9efbfc922b0baf37485f6ef๐Ÿ”
>all the whining about cmake
How good (bad) are LLMs at shitting out cmakes that just werk?
Anonymous
7/26/2025, 12:28:13 AM No.106026790
>>106014601 (OP)
Ugly syntax and shit codebases in any large project that uses it.
Anonymous
7/26/2025, 12:29:49 AM No.106026816
>>106014660
rust is what you'd get if you took c++ and said "yes it's retarded, but can we make it gay too?"
Anonymous
7/26/2025, 1:16:48 AM No.106027485
>>106024770
Just do C-style C++
Replies: >>106028791
Anonymous
7/26/2025, 2:24:22 AM No.106028345
1753460697782176
1753460697782176
md5: e87f9511d951db7b68f55c9e03babc94๐Ÿ”
>>106014935
whats the alternative lil nigga? no i want learn mason ninja jinja cmake autotools or whatever the fuck makefile syntax you have

would honestly rather get RATed by a malicious crate or npm package.
Replies: >>106028921
Anonymous
7/26/2025, 3:02:36 AM No.106028791
>>106027485
Or how about I just use C then
Anonymous
7/26/2025, 3:18:08 AM No.106028919
C++/Rust are basically the same language now days. I do like C++ modules but both languages are a fucking mess. We need C with namespaces, a good hashmap, a good dynamic array baked into the language and defer.
Anonymous
7/26/2025, 3:18:30 AM No.106028921
>>106028345
the alternative is rust crates and npm packages
Anonymous
7/26/2025, 3:31:10 AM No.106029032
>>106014601 (OP)
nothing
you'll have to realize that & is another name for a variable living somewhere else, const& is the same thing but also keeps you from accidentally changing the value, that's all
if it's smaller than a pointer - pass it by value
don't bother with moving, compilers are smart enough to do it for you unless you write something so fucked up you confuse the compiler
never use raw pointers, c arrays or c libraries, always use c++ containers and smart pointers, avoid defines like hell, most things you can do with defines you can now do with constexpr and templates
that's all there's to it, idk why people consider it a hard language, it's not hard unless you're doing things that are not hard but straight impossible to do in other languages
>t. 10 YoE with C++
>>106014950
>The hardest part of C++ is dependency management.
conan
Anonymous
7/26/2025, 6:07:48 AM No.106030353
There's really not much of an excuse to complain about CMake in an age where you have access to LLMs to spoonfeed you on how to use it. If you can learn the following:

add_executeable(...)
add_library(...)
target_link_libraries(...)
target_include_directories(...)

You're good for 95% of the bullshit you'll have to do with CMake. There is a lot of retarded shit with CMake, no doubt, but out of all the shitty options it's the thing everyone has converged on for a reason. But honestly a lot of the retarded shit in CMake is the result of its retarded USERS who do batshit insane things in their CMakeLists.txt files. You can keep things really simple if you want to. Really question if you need to do complex bullshit in your CMake scripts (there's a good chance that no, you absolutely don't need to you fucking retard).

Also, regarding managing dependencies: just use vcpkg. It integrates will with CMake and is the least painful option in my experience. You can get mad at CMake and C++, but these things are the way they are because of the design decisions around C++ itself (of which there are many retarded decisions).
Anonymous
7/26/2025, 6:15:48 AM No.106030412
>>106023248
MSVC can compile cross-platform and Visual Studio also supports the Clang toolchain.
Anonymous
7/26/2025, 6:23:51 AM No.106030476
Hereโ€™s the real trick for any language and especially for C++
Since you already have a problem you want to solve you identify which libraries or technologies you can use and you conform your style and use of a languages features to mainly match what the technologies are using and maybe only use other language features if itโ€™s the only smart way to solve it

For example you are using a fully featured toolkit for audio that uses C++
You work within the style of that toolkit

Find a problem to solve first then approach this way, you will learn more than going through all features and trying to understand them

Next problem, new library in C++ you conform to its style and best practices
This way if you do open source it other people using the same stuff will immediately be able to work on it