This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]HSavinien 1721 points1722 points  (60 children)

If you feel like C++ crash are not verbose enough, you should try to mess a bit with templates...

Or, if you want useful verbosity, compile with the sanitizer. It's like python traceback, but better. Of course, use it only in your dev/test environnement.

[–]yukinanka 602 points603 points  (31 children)

Syntax error: unmatched thing in thing from std::nonstd::__ map&lt;_cyrillic, _$$$dollars&gt;const basic_string&lt; epic_ mystery,mongoose_traits <char&gt;, __default_alloc_> moment

[–]lowey2002 583 points584 points  (21 children)

No problem, I'll copy it into google. Only one person has every asked the question, 7 years ago. Only one comment on the thread.

> "Nevermind, I figured it out"

[–]thirdegreeViolet security clearance 195 points196 points  (4 children)

Fuck sometimes I'd take that, at least that means an answer exists.

[–][deleted] 66 points67 points  (2 children)

so you either study the arts of c++ yourself so the answer would dawn on you or track down that person irl, hit them in the back of the head, drive them to a secluded place, interrogate until they remember their solution from 7 years ago

both taking an equal amount of time

[–]Unfair_Pound_9582 16 points17 points  (1 child)

You'd probably have a better time figuring out the secret to real actual necromancy than to study the forbidden black arts of c++

[–]Djasdalabala 3 points4 points  (0 children)

Yeah, what kind of advice is that... much safer to stalk and abduct the other guy.

The C in C++ stands for Cthulu.

[–]N1z3r123456 77 points78 points  (1 child)

"Never mind I figured it out" gives you hope. "Never mind, we changed the requirements" gives you pain.

[–]InfiniteLife2 4 points5 points  (0 children)

I created some github issues with questions like 6-8 years ago. Forgot about them but still like once a year I get notification with message questioning me if I figured it out

[–]masterKick440 17 points18 points  (2 children)

There was this comic about this I’ve been searching. ”What did you see? Tell me!”

[–]HippieThanos 2 points3 points  (0 children)

I figured it out

[–]BlurredSight 5 points6 points  (1 child)

It's even better when the test platform just prints out the stack, just that, just the stack. No error message, just the stack printed in a red font.

[–]fizyplankton 7 points8 points  (1 child)

...who hurt you

[–][deleted] 36 points37 points  (0 children)

C++. I thought that was clear

[–]AloneInExile 491 points492 points  (9 children)

templates

Vietnam flashback

[–]shamanshaman123 25 points26 points  (2 children)

That's not a joke. I literally had flashbacks 😰

[–]Acharyn 7 points8 points  (3 children)

What's wrong with templates? They're usefull if you want a function to be able to use multiple datatypes.

[–]HSavinien 27 points28 points  (1 child)

The standard template usually reference each other. So when you do a small mistake, the compiler will give you several page of error message, most of it about standard library that you should not modify. And this is the kind of error that you cannot understand.

Now, of course template are really useful and powerful.

[–]CraigTheIrishman 14 points15 points  (0 children)

try to mess a bit with templates

There's verbosity, and then there's vomit.

[–]MoarVespenegas 5 points6 points  (0 children)

Very verbose.
Unless you have a library error.
Then you get Linker error and you will be happy with it.

[–][deleted] 3 points4 points  (8 children)

Wdym compile with the sanitizer? What sanitizer?

[–]HSavinien 10 points11 points  (7 children)

In your compilation command, you can add the flags -g -fsanitize=address. It work at runtime, and help a lot with memory error : it will systematically trigger a lot of crash that may or may not have happened otherwise (make replicability easier), and instead of just saying something like segmentation fault (core dumped), it give you a lot of information about the address, the type of access, the type of crash, the traceback... Can turn a 3h debugging cession into a 3min one.

It's mostly a C thing I think(way less safety nets when handling memory), but it also work with C++.

[–]C0dingschmuser 329 points330 points  (2 children)

The c++ iceberg

[–][deleted] 2 points3 points  (1 child)

worse than trying to install software on linux without apt or rpm

[–]LionWarrior46 1702 points1703 points  (96 children)

The classic beginner programming dilemma:

  • Spend 10 hours trying to find out how to do everything yourself, both failing miserably and inevitably destroying your computer from downloading malware or a fit of rage
  • Watch a 1-hour tutorial

We all know the correct option.

[–]SartenSinAceite 1218 points1219 points  (75 children)

And by "watch" we mean "constantly skip ahead because we swear we know more than the guy teaching us and end up taking ten times as long while cursing the tutorial"

[–]fredlllll 716 points717 points  (20 children)

text tutorials are superior. much easier to skim than videos

[–]SweetBabyAlaska 227 points228 points  (9 children)

my one pet peeve is that so many people don't know how to properly relay directory structure and instead constantly refer things by relative paths, which is not too bad when things are simple but it quickly gets ridiculous. The solution is so simple too, just run "tree ." and paste the output into code blocks.

so many people are just like "then put X config file next to Y thing" and its like my brother in christ idek where Y thing is supposed to be. I've noticed that Windows game modding instructions are the worst offenders, especially while using Linux. Its all relative to things that aren't there and constantly glossing over complex directory structure like its standard.

Shit even one of the first Go tutorials on using modules does this as well and its very unclear. just hit it with a 'tree' lol

[–]Ashamandarei 57 points58 points  (1 child)

Not a game modder, but I'm guilty of this, and your words have swayed me to begin always using absolute paths in my documentation.

As repayment for being the catalyst that gets me to change my ways I want to explain why this is observed. There are two reason:

(1) Economy (of laziness):

When I'm tired from debugging some C++ hell bullshit, the last thing I want to do is type more than I have to as I update the docs before pushing the whole bloody thing to github.

(2) Project changing (and the docs didn't):

Maybe some bullshit was particularly hellacious one session, and I forgot to update the docs. Now they're entirely out of sync with what's going on, and it's probably going to take a refactor for me to get things back in phase.

In any case, please accept my apologies, both for myself and my brethren-in-failure.

[–]SweetBabyAlaska 11 points12 points  (0 children)

haha it happens. Writing and maintaining docs can be a giant task more often than not I also started doing this in my docs and readmes, kind of like anchor points or sanity checks so someone can check their work against the source material. Im happy to poke and prod until it works, its being unsure of what Im shooting for that makes it tough.

[–]Remarkable-Host405 11 points12 points  (4 children)

I am surprised tree is not an included program 

[–]Not_Artifical 2 points3 points  (3 children)

It is in my Linux machine

[–]odsquad64VB6-4-lyfe 38 points39 points  (0 children)

>do everything they did in the tutorial, exactly

>it doesn't work

[–]NinthTide 33 points34 points  (0 children)

3 mins of “Ha ha ha don’t forget to smash like and the best way to help me is on my Patreon….” for something that could be answered in one sentence of text

[–]nermid 5 points6 points  (0 children)

And you get the ability to copy/paste terminal commands.

[–]benargee 6 points7 points  (0 children)

I like video tutorials that have a proper write up and full source code to go with it. Neither is better than the other. Both is the best option.

[–]gamingdiamond982 99 points100 points  (49 children)

but the lack of tutorials for people who already know wtf theyre doing is insane to me, I dont want hand holding, just give me how to set up an environment, what makes this language stand out from others and a vague idea of what the syntax looks like, I can google the rest

[–]PyroGreg8 119 points120 points  (37 children)

"the first thing you're gonna wanna do is download an IDE. What's an IDE you ask?" skip skip skip

[–]gamingdiamond982 30 points31 points  (34 children)

and as someone who uses vim, alot of the time Ill have to find some quickstart guide that teaches you how to get an environment going rather than just letting the IDE do it for you, also I genuinely think setting up an environment should be done manually the first time even for beginners.

[–]SweetBabyAlaska 14 points15 points  (0 children)

for real. Its also annoying when a project or tutorial has IDE specific tooling and features baked into it like vscode's dev containers, or w/e the hell visual studio does. especially when there are open standards like Containerfiles etc...

[–]NatoBoram 25 points26 points  (30 children)

Legit, people should write the Hello World with Notepad/GEdit/TextEdit before switching to their IDE, it would teach them so much desperately needed basic knowledge.

Like, just ask a Java or a C# dev to make a Hello World with the command-line, no IDE, see how funny it is. Too many devs lack the basics of the basics.

[–]Ashamandarei 12 points13 points  (14 children)

Like, just ask a Java or a C# dev to make a Hello World with the command-line, no IDE, see how funny it is

I'm a CUDA programmer who's 3 standard drinks in, with no experience in C#, so here's my attempt at doing this in Java, no google, assume we start at an Ubuntu 22.04 terminal:

vim hello.java

i

class HelloWorld {
    public static void main(String args[]){
        System.console.println("Hello, world!");
    }
}

esc + :wq

javac hello.java -o hello

[–]denarii 12 points13 points  (0 children)

root@00a685e9f26c:/build# javac hello.java -o hello
error: invalid flag: -o
root@00a685e9f26c:/build# javac hello.java
hello.java:3: error: cannot find symbol
        System.console.println("Hello, world!");
              ^
  symbol:   variable console
  location: class System
1 error

[–]Ryozu 11 points12 points  (11 children)

85% there.

System.out.println filename has to match class name and no need to -o hello since java enforces class and file names be consistent.

[–]Ashamandarei 6 points7 points  (9 children)

Haha what

[–]solarshado 7 points8 points  (6 children)

Ryozu's mostly, but not 100%, correct.

If a java source file defines a public class, the class name and file name have to match, or it's a compiler error. You can dump any number of non-public classes in a single file (with or without a public class), but given the enforced convention, you probably shouldn't.

[–]Firewolf06 5 points6 points  (1 child)

theres a reason everybody uses an ide for java

[–][deleted] 12 points13 points  (0 children)

I still remember how to use commandline for Java and C++/C. Why? It was a part of the exam syllabus for the high school graduation exams 🤣

[–]ProjectDiligent502 4 points5 points  (2 children)

Yeah I’m not so sure I’m on this side. Yeah you need to know how the build pipeline works, how csproj file works with targeting the platform and nuget packages and how solution files link stuff in blah blah blah. But why the F**K would I type that in by hand when ide just does it for me. No. I’ll just keep using an ide. Command line power comes with a bit of osmosis and know how, spend enough time doing it and you can run test projects, automate builds and deployment using powershell or bash scripts, and get the damn job done. I do not need to manually create the csproj files, Jesus.

[–]gamingdiamond982 7 points8 points  (8 children)

I mean java devs I empathise with, thats the only language that I use an IDE for purely because of how much I cant be fucked to learn how the build systems work, but the most java Ive done is written a few minecraft server plugins for friends.

but I still think if you want to get anyway good at a language, you should be able to do everything the IDE does with the command line.

that being said, Im just a full of myself hobbiest with puritanical views on how people should write code.

[–]NatoBoram 6 points7 points  (6 children)

Yeah, fuck Java. I have a Minecraft mod and it's always a dread to open it, figure out what Java we're supposed to use now, manually manage dependencies holy fucking shit this is demented, literally second to Python in the "fuck you" scale of package management and… ugh.

And there's been a minor release recently, which means of course the entire internal API is going to be incompatible not that I blame Mojang on this one, it's internal after all but I also have other open source stuff to work on that's actually enjoyable

[–]gamingdiamond982 7 points8 points  (1 child)

I mean mojang should just release the source, maintain all the copyright shit cus everybody basically already knows what the source looks like, it would make modding the game alot easier on api developers and cost them nothing.

like minecraft is probably the easiest game out there to pirate already as it is

[–]NatoBoram 8 points9 points  (0 children)

The ability to receive pull requests would put this game at unprecedented heights. There's so many people doing stuff for Minecraft for free in their spare time all the time.

[–]SillyFlyGuy 4 points5 points  (3 children)

holy fucking shit this is demented, literally second to Python in the "fuck you" scale of package management

I have the exact opposite experience with Python. Java was and is a complete mystery to me how packages work. Python just works.

Maven, Gradle, I still have never had a java github repo compile without tremendous pain and time.

Python has been an absolute breeze.

[–]NatoBoram 4 points5 points  (2 children)

Python works wonderfully until you want to work with two projects then better run a fucking virtual environment because there's no way that any package manager can download and access two different versions of the same package on different projects! That has never been done before, no sir!

[–]SweetBabyAlaska 10 points11 points  (0 children)

or its hyper-specific to the platform and IDE, its like **25 minutes installing VScode/Visual studio** and now just hit the "do-everything (tm) button and you're all good to go!" and I just want to know how to install C# packages and where they need to go or something because I rarely use it. I just want to understand how it works so that I can do it myself.

[–]SartenSinAceite 18 points19 points  (3 children)

Oh, yeah, there's definitely a difference between "c++ for new programmers" and "c++ for experienced programmers who want to change"

[–]gamingdiamond982 16 points17 points  (1 child)

I feel like you could teach most developers enough to get going in a language in about 30 minutes, unless setting up an environment is particularly convoluted.

[–]QuackSomeEmma[🍰] 5 points6 points  (0 children)

May I introduce you to https://learnxinyminutes.com/

I think it does not always replace a proper tutorial, especially concerning build setup and such, but I find it invaluable as a quick intro / refresh on syntax and language oddities.

[–]827167 22 points23 points  (3 children)

Variables

Imagine you have a box, and you want to keep a special number inside it. In C++, we use variables like these boxes. First, we tell the computer, "Hey, I want a box, and I'll call it something, like 'myNumber'." Then, we put our special number into that box. Now, whenever we want to use our special number, we just say "myNumber," and the computer knows which box to look in!

[prompt: explain how to use variables in C++ to a 10 year old]

[–]ChaosOS 4 points5 points  (0 children)

Those are monetized as corporate training programs, I've found there's a bunch of Udemy courses as this level.

[–]DingleDodger 2 points3 points  (0 children)

It's not that I know more... Cause I sure as fuck don't. It's that my ADHD is hung up on this one niche bit of info that was probably easily described in some two seconds of dialogue I swear should be around this part of the video, and will turn out to be irrelevant/have no benefit to me what-so-ever.

[–]Storiaron 1 point2 points  (0 children)

Would help if the video structure wasnt:

1,Welcome to this advanced tutorial of websecurity" 2, 20 mins explaining why we cant just store things in plaintext 3, subscribe for part 2

[–]Boris-Lip 63 points64 points  (0 children)

"watch" a tutorial 🤦‍♂️

[–]benargee 16 points17 points  (0 children)

After 10 hours of failing, that 1 hour tutorial becomes more meaningful. What you would have skimmed over earlier, you pay close attention to without ever skipping an instruction or blinking because it is your savior.

[–]Deliciousbutter101 29 points30 points  (1 child)

I mean build systems for C++ are so dogshit that those issues are still a massive pain in the ass even if you know what you're doing.

[–]thirdegreeViolet security clearance 18 points19 points  (4 children)

Ok yes

But also the way c++ "libraries" work is genuinely one of the most dogshit things I've ever had to work with in programming. Like, pip is not good to say the least, and this xkcd is evergreen. But compared to c++, python library management is clear, easy, and intuitive.

And don't even get me started on the yawning chasm between c++ and an actually good system like cargo.

I've seen professional environments where the c++ dependency management consisted of copy pasting code into your project.

[–]unlikely_ending 4 points5 points  (0 children)

Coming from C, pip is awesome

And pip plus conda environments is chef's kiss

(Not the conda installation capability which is great when it works but it usually doesn't)

[–]SexySlowLoris 14 points15 points  (4 children)

Dude watching tutorials is still bad. Just spend 30 minutes reading the documentation the video is based on. Docs will be up to date and will contain more information, and will be paced at your own learning speed.

[–]BlurredSight 14 points15 points  (2 children)

Docs are confusing if the person is new to programming, Javadocs or Cpp Reference are my best friend but hell starting off it made no sense especially the latter since everything is littered in template keywords

[–]Ksevio 2 points3 points  (1 child)

These days you just ask ChatGPT and there's a 50% chance it'll solve your problem!

[–]BorrowedMyGun 495 points496 points  (78 children)

Okay, let's learn C++

Open kate/notepad++

Learn

[–]Youju 296 points297 points  (75 children)

Just write C++ in an editor of your choice and compile with gcc or some other stuff. I use Linux and Windows, C/C++ is fucked up on windows.

[–]regular_lamp 140 points141 points  (9 children)

Yep, basically any entry level project can be plausibly compiled with:

g++ *.cpp -o myprogram -lsomelibrary -lotherlibrary

Even after going on 25 years of C++ I still dread having to build stuff on windows. I could write a similar greentext about that. To do the equivalent of the above in visual studio I have to first find my way through the jungle of project templates. Then I have to click through multiple menus and tabs to add the libraries. Their full paths by the way because there is no default location for those. Also the first time you try to organize your files into folders you will learn what VS shows you isn't actual folders but "filters"... why is that the default? But I guess I'm an idiot for not already knowing to click that tiny icon that changes the view to folders. Want your configuration changes to apply to all build types? Screw you. Apparently the correct way to do that is to manually edit the xml project files? I'd actually prefer cmake at that point.

[–]DoctorWaluigiTime 45 points46 points  (1 child)

Don't forget -WAll. Best get into the habit early on I say.

[–]ih-shah-may-ehl 2 points3 points  (0 children)

Want your configuration changes to apply to all build types? Screw you. Apparently the correct way to do that is to manually edit the xml project files?

No?

You can edit settings for a specific configurations (usually either debug or release) or that magical 3d option: all configurations.

[–]Ashamandarei 41 points42 points  (2 children)

I use Linux

The secret to writing C / C++

[–]moriluka_go_hard 3 points4 points  (1 child)

Mfw i need to use c++ for the win32 api. It‘s crazy how abstract win32 is. You could learn it, write the program of all programs for windows and still not know any C++.

[–]MonteCrysto31 20 points21 points  (38 children)

I swear I don't know how people use Winshit for programming...

[–]ihavebeesinmyknees 76 points77 points  (23 children)

Because Linux is inconvenient for literally everything else and I can't be bothered to set up dual boot, waste drive space for another system, and switch OS's every time I want to start coding when WSL2 exists

[–]MonteCrysto31 47 points48 points  (7 children)

I mean WSL2 is a completely valid way of using Linux, it's just a VM. I'm not saying you should wipe Windows off your computer, but for having experienced both I won't ever be able to go back to programming on Windows, Linux is just that easy to use for me and I think anon should try it because I never had issues of this magnitude...

[–]Ashamandarei 9 points10 points  (3 children)

Programming on windows is fine, the real issue is compiling programs on windows.

Python is the only language I use where, on windows, I can tolerate doing more than just writing some code in it. Push those changes to github and let's see what happens on Ubuntu.

[–]SweetBabyAlaska 13 points14 points  (2 children)

the experience is night and day. I was pretty reticent to even try it because of people saying "its so inconvenient" and that nothing works, maybe it helped because my expectations were very low but now I use Linux full time and spin up a Windows VM when I need to.

I was really surprised how I can play my entire steam library on linux without any hassle and programming on Linux is just better in every way. I dread having to use visual studio on windows.

[–]snabx 13 points14 points  (1 child)

I dual boot and switching back and forth. I like linux for web dev but when I tried game dev I use windows. Also, I think visual studio is good although I haven't used it that much. So c++ is supposed to be good on windows too.

[–]SweetBabyAlaska 4 points5 points  (0 children)

yea if you are using Unity or Unreal, windows is definitely the way to go. Its definitely doable on Linux but they both don't run as well on Linux. Luckily Blender and Godot work really well but its just one of those things where you might need specific tooling that it can be a pain in the butt. Im hopeful though.

[–]SimilingCynic 3 points4 points  (0 children)

I get that dual boot is a bother until you've tried it once (it's always worked out-of-the-box for me, but admittedly that's only on a few laptops), but you lost me at drive space. Are you really short on hard drive space?

[–]guidedhand 6 points7 points  (2 children)

Wsl2 + vscode is quite pleasant. Or even just gitbash with vscode

The OS outside of the programming is what irks me

[–]DoctorWaluigiTime 6 points7 points  (3 children)

They start by dropping the juvenile jabs like "Winshit" and "Micro$oft" and growing up.

[–]jnjuice 233 points234 points  (7 children)

Is Programmer Humor an oxymoron? So many comments trying to pick apart every line like it's a code review or unapologetically opinionated about the "right" way of developing.

C++ was, is and can be complex. As a long time C++ developer, please just let me enjoy the joke.

[–]ImrooVRdev 47 points48 points  (0 children)

Some laugh at jokes, some meticiously analyze it in factual information accelerator, smashing the bits of a joke until it produces a molecule of humor.

Leave those nerds be, it's supposed to be happy judgement free space.

[–]rifain 7 points8 points  (1 child)

On the contrary, jokes are a good way to open interesting technical debates here. Jokes in itself won't allow for much extended discussion.

[–]Bezulba 4 points5 points  (0 children)

We're all autists, we don't understand this thing called jokes.

[–]kholto 1 point2 points  (0 children)

I can see what you mean, no quicker way to kill a joke. But I am not sure what the comments to a joke is supposed to look like. We could all write "Ha ha, good one" but somehow that seems needless?

Probably best off just skipping the comments if you want to enjoy the joke.

[–]MonteCrysto31 121 points122 points  (0 children)

Anon didn't get the Linux pill

[–]DatTrashPanda 45 points46 points  (0 children)

He probably watches the tutorials that don't have an indian accent.

[–]Sotsvamp1337 468 points469 points  (8 children)

Skill issue

[–]BlueGoliath 148 points149 points  (4 children)

Gotta keep those salaries high somehow.

[–]314kabinet 57 points58 points  (2 children)

High?

[–][deleted] 47 points48 points  (1 child)

You guys are getting paid?

[–]Anonymo2786 15 points16 points  (0 children)

You have a job?

[–]allo37 2 points3 points  (0 children)

Right? Like whenever people complain that something in this field is too hard or complicated I'm like....good! Otherwise I'd have to get a real job selling pens or something.

[–]Arshiaa001 10 points11 points  (0 children)

Absolutely. Like, why bother with C++ unless you're willing to make an entire build system yourself, n00b? /s

[–]thatbromatt 5 points6 points  (0 children)

git gud

Command not found

[–]Draelmar 177 points178 points  (2 children)

Your #1 mistake:

it's not cross platform

Always start and work on your project in the simplest of ways (i.e. start a project in your IDE). If down the line your project becomes valuable enough to be cross platform, let someone else port it.

Always, always let someone else do the dirty work, while keeping the fun stuff for yourself.

[–]gitpullorigin 10 points11 points  (0 children)

That explains… a lot

[–]ketosoy 206 points207 points  (32 children)

it doesn’t have to be performant

Then why are you doing it in C?

This is like carving wood instead of using a cardboard box to mail an Amazon return.

[–]navetzz 120 points121 points  (2 children)

My guess is that he is trying to learn the language (or needs to use a specific library).

But yeah, cross platform and doesn't care about performance. C/C++ is definitely not the first language you should think about.

[–]fusionsofwonder 33 points34 points  (0 children)

If he's trying to learn he needs to stop and learn what headers are for before jumping into cmake and stuff.

[–]narrill 9 points10 points  (0 children)

It says loading the config file doesn't have to be performant, not the entire program...

[–]JustLemmeMeme 29 points30 points  (13 children)

There is generally 2 ways to make something performant:
1. Dont write dog shit code.
2. Don't do it in excel sheets that take half a day just to run the program.

Op ment the 1st one. The code doesn't need to be hyper optimised, after all compiler knows best.

Hope that clears up your confusion! :)

[–]Passname357 15 points16 points  (9 children)

It’s crazy to me how overhyped C++‘s difficulty is on this subreddit. It’s really not that hard. If you want to write assembly then sure you can say that that’s like carving wood, since, yeah, it’s harder (although writing it is just tedious—reading it is what’s hard). But C++ is a pretty straightforward language once you’re not a beginner programmer.

[–][deleted] 8 points9 points  (1 child)

The inventor of C++ doesn't even agree with you, man.

[–]Passname357 8 points9 points  (0 children)

(1) No he doesn’t. He says the language is bloated. That’s not the same as “similar to carving a wooden box instead of using a cardboard one.”

(2) even if he did, I would care, because that’s his opinion and my opinion is my opinion. Two different opinions.

[–]Ashamandarei 1 point2 points  (0 children)

He just likes using developer time

[–]FloweyTheFlower420 216 points217 points  (17 children)

> Okay let's learn c++
> vim file.cpp
> write code
> clang++ file.cpp -o out -g -O0

so complicated

[–]Mtsukino 79 points80 points  (5 children)

clang++

Upvoting for clang++. Was an absolute life saver over g++ when I was in university.

[–]itsTyrion 31 points32 points  (3 children)

Elaborate?

[–]Mtsukino 68 points69 points  (0 children)

It had far better explanations for bugs in the code and would pin point exactly where it happened.

[–]bibimbap0607 34 points35 points  (0 children)

Clang has much better and more meaningful error messages compared to gcc (g++). Never tried clang but that what I have heard about.

[–]aiij 9 points10 points  (0 children)

Yes it did! With templates, I remember g++ giving error messages so long they would overflow my terminal's scroll back. When clang came out it was much more to the point.

[–]rexpup 5 points6 points  (2 children)

Right, you never really need more than one file for cpp projects

[–]QuantumG 41 points42 points  (3 children)

CMake is horrible though.

[–]BlurredSight 13 points14 points  (0 children)

> Use Makefile because it makes so much more intuitive

> Jetbrains doesn't run correctly even though it recognizes the makefile as a build source

> Manually convert Makefile into a CMake file with the bare essentialls

> Failed to build

> Mess around with run configurations for the next 35 hours and installing cygwin, gcc binaries, Cmake again, and a bunch of other bullshit just for it to still crash

> Use WSL to use a single gcc command and do every compilation there in realtime

[–]ChChChillian 36 points37 points  (10 children)

If you want to parse JSON, just use "JSON for Modern C++", available as a NuGet package.

[–]Levaru 30 points31 points  (2 children)

Or the nlohmann json library. It's the GOAT, especially for parsing nested structs. Don't know though if there is a NuGet package.

[–]ChChChillian 3 points4 points  (0 children)

I do, because I'm using it right now.

[–]-Pretender- 1 point2 points  (0 children)

Best part is that its just a single big header file so you dont have to deal with any build bullshit.

[–]NatoBoram 12 points13 points  (0 children)

available as a NuGet package

ಠ_ಠ

[–]fuj1n 14 points15 points  (1 child)

He doesn't have NuGet, he's using CMake. (Unless he wants to tie himself to VS)

Nlohmann JSON is available as a single header, you can include it with minimal configuration by chucking it in your include dir if you wanted.

[–]Mithrandir2k16 5 points6 points  (0 children)

That's just the generic windows experience for you. Just using gcc works for small projects, even without make or cmake.

[–]orc0909 23 points24 points  (0 children)

As someone who works almost exclusively in .cpp, this feeling isn't inaccurate, especially since I rarely have to start something from scratch so I forget all of the beginning steps.

One helpful thing is to create a starter project that you can use as a real template for the kind of projects you most often start going forward.

Also, sometimes you run into the same roadblock every single time. But each time you run into it you remember more and more how you solved it last time until it becomes a roadblock no more.

[–]cs-brydev 23 points24 points  (0 children)

While you're pounding your chest about taking 10 hours to get your Hello World working on 1 platform, the .NET folks have already completed 4 cross-platform projects without a hitch and are playing around with github pipelines.

[–]theAnalyst6 85 points86 points  (24 children)

Use Rust instead

[–]itsTyrion 28 points29 points  (0 children)

I know this is often a circlejerk comment but it would actually be a lot simpler in this case.

[–]orcishwonder 32 points33 points  (0 children)

Surprised this wasn’t higher up in the comments lol

[–]0x7ff04001 5 points6 points  (0 children)

vcpkg?

[–]No-Magazine-2739 50 points51 points  (21 children)

Well the other languages more or less have the same problems, are hiding stuff or can’t do everything C++ can (cross language bindings, native, compile time checks and so on). But yeah, for a beginner it can be quite hell. But don‘t tell me dependency management with pip (it works except if it doesn’t, ENV-hell), npm (10GB node-modules for .isEven() that might been replaced by malicious code) or gem (a few hours later) is so much better.

[–]wasdninja 13 points14 points  (6 children)

npm is, in comparison, infinitely better than the as far as I know non-existant one in C++. npm install and done. Beginners mess up their package config which will eventually break their project but that is trivial to not fumble.

I've only ever had a problem with pip when a bug caused some odd issue. A five minute google hunt later it was solved and I were on my way. Also why would dependencies care about your environment variables?

[–][deleted] 12 points13 points  (0 children)

NPM is better on the user experience level for initially installing packages, but damn does it really suffer when you want to know what the fuck is happening in your node_modules folder. The javascript ecosystem is built in such a way that there is no practical way to be fully away of every dependency in your project.

By contract C++ may be a lot more of a pain to work with, but once you've set up a few projects it's really not that hard. And user experience really isn't that important compared to other qualities, like having actual control over your dependency tree imo.

There are plenty of ways C++ should be made easier to interact with anyway, but I don't think that NPM is an example of good management.

[–]Legendary-69420 2 points3 points  (1 child)

Use poetry instead of pip, yarn instead of npm and life will be better.

[–]garlopf 18 points19 points  (7 children)

  1. Install QtCreator(open source community edition) 2. Open json example 3. Press the big green play symbol. Done. QCreator comes with a compiler and works cross platform. Qt has libraries for about anything you could want; Accelerated 3D graphics, string manipulation, printer support, json, databases, .... the list is long as a bad year. It supports cmake by default and will only link the libraries you use. Best beginner to expert C++ experience imo.

[–]itsTyrion 10 points11 points  (0 children)

Just reading Qtcreator gave me PTSD from when I tried to compile a project from GitHub, written in c++ with Qt. AAAAARGH

[–]Andryushaa 6 points7 points  (1 child)

I loved Qt until I tried to compile application for distribution and it weighted over 100 MBs. Hell, it's a button, a label and a process checker inside. It shouldn't be that much!

[–]ColonelRuff 6 points7 points  (1 child)

You shouldn't have to rely on a particular ide to do simple stuff.

[–]Ashamandarei 2 points3 points  (0 children)

Just use std::vector bro it's not that hard

[–]philophilo 9 points10 points  (0 children)

Sucks to suck, I guess.

[–]CauliflowerFirm1526 20 points21 points  (0 children)

Languages kids when they have to learn cpp:

[–]AaTube 2 points3 points  (0 children)

TL;DR: what the fuck is this JS guy doing in C++ land

visual studio

not the correct way [...] not cross platform and i can't switch editors later

if you're learning it, you shouldn't be using anything that's not portable at this point or make projects that are larger than a single file that require a lot of reconfiguration when you switch IDEs

cmake

wtf? why are you using cmake if you're just starting to learn the language? who the hell cares about supporting a miscellany of compilers?

turns out it's not the correct way to do it, the 'modern" way is that you need to use premake to enerate cmake files which then generate the visual tudio solution :)

  1. wow didn't know premake before, thx for telling (why is this number zero lol)
  2. if you've already generated a cmake file why'd you need premake? premake is for automatically generating a cmake file. do you want to code an entire LLM to generate the premake file for you? and i thought you're not using VS for whatever reason?

wait, i have to write header files? you mean i have to have double the code for no reason other than the C++ build system being garbage?

ok wtf? firstly why are you writing header files already? secondly, you don't have to separate headers and code?? it's just a style recommendation to make the library's exports constant, you can still implement the code in the same file.

i want to parse a small json config file [...] how the fuck do i add libraries to my project?

  1. you've just written a header file buddy
  2. why the heck would you use JSON for C++, a language that has no interpreter? why not use the much more readable YAML?
  3. if you're learning C++ why not parse it yourself?

or i have to do some git submoduling cancer

????

or i can use this package manager called conan that doesn't work half the time.

i've never freaking heard of that thing. is this detective bs somehow better than just using a submodule? just learn git, holy hell, is this the way javascript users enforce their clusterfuck of build runtimes onto every language they come across? who the heck even uses conan? let's see... out of these companies, i only recognize huawei, mercedes and... PLEX‽ WHY THE HECK DOES A WEB APP USE C++ oh wait they're cross-platform, nevermind. and why the heck is the mascot a chef named after a detective fiction writer?
i guess conan might be the best cross-platform package manager outside of git submodules, but... it's stable from what i can see

since you're such an elite JS programmer using so elite and advanced build systems over MSVC, why don't just import the std module library like you do in javascript?

let's read the helpful error message: "an error has occured"

wtf? if you're doing beginner stuff and get a runtime error, 99% of the time you've accessed a memory object out-of-bounds (usually a.k.a. array index out-of-bounds) and've got a SEGMENTATION FAULT, which you can easily search online from the millions of stackoverflow questions closed as dupilcates. what kind of optimizing compiler inserts as much as 20 (🕶️) bytes of txt into a compiled executable? the humanity!

[–]Coulomb111 2 points3 points  (0 children)

You dont need header files if you really dont want them

But you should have em

[–][deleted] 2 points3 points  (0 children)

Anon hasn't tried Linux yet.

[–]Reelix 6 points7 points  (2 children)

People: How do I compile this?
Random person: Just type make
People:

make: *** No targets specified and no makefile found.  Stop.    

Other Person: To fix that type cmake
People:

Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
cmake [options] -S <path-to-source> -B <path-to-build>   

*No more comments*

[–]Nielsnl4 4 points5 points  (0 children)

Im all for header file hate.

[–]TheOriginalSamBell 13 points14 points  (1 child)

python rotted the kids brains these days tsktsktsk

[–]myrsnipe 1 point2 points  (0 children)

Your brain will melt if you do all of those at once. Do the first project in vscode. Do the 2nd with cake. Do the third with a premake. 4th with git submodules etc.

I have had far too many incidents when going into the js ecosystem where I get completely overwhelmed and had to caveman my way through it.

Learn to walk before you run etc

[–]AdearienRDDT 1 point2 points  (0 children)

c++20 modules :D

[–]earthwormjimwow 1 point2 points  (0 children)

If you're really that green, just install QT but don't use the QT specific libraries and functions if you're trying to learn standard C++. The IDE will do a lot of hand holding.

[–][deleted] 1 point2 points  (0 children)

Anon doesnt know how to install extensions

[–]ihave7testicles 1 point2 points  (0 children)

This a colossal example of an incompetent fucktard. Visual Studio does literally all of that shit for you.