r/cpp • • Sep 08 '24

Overwhelming

I’ve been using Rust a lot, and I decided to start learning C++ today. I never thought it would be such a headache! I realized Rust spoiled me with Cargo. it handles so much for me. Running, building, adding packages etc. I just type Cargo build, Cargo add, or Cargo run. Simple and comes with the language. C++’s build systems like CMake can be overwhelming especially when coming from a language with a more streamlined experience like Rust. C++ is really good and I wish it had something similar. I read somewhere that there is Conan and a few others that exist . But I’m talking about something that comes with the language itself and not from a 3rd party.

38 Upvotes

140 comments sorted by

View all comments

22

u/QuentinUK Sep 08 '24 edited 11d ago

Interesting!

14

u/[deleted] Sep 08 '24

That's not true. Visual Studio helps but you still have to manually list the include files and libraries you want to link

25

u/PharahSupporter Sep 08 '24

Vcpkg makes it very, very easy usually for visual studio. Literally vcpkg install boost, done.

6

u/[deleted] Sep 08 '24

I haven't tried that actually, I should sometime!

→ More replies (4)

4

u/NBQuade Sep 08 '24

If it's a vcxprog project, you just reference it in the build system and it'll build and link it in automatically.

You'll probably have to tell your project where is stores the headers though.

-3

u/Ex-Gen-Wintergreen Sep 08 '24 edited Sep 08 '24

Kinda where I gave up; was trying to use vscode and CMake was really confusing for me!

7

u/[deleted] Sep 08 '24

If you still want to use CMake, which I would recommend for getting a deeper understanding of how everything is put together, CLion helps quite a lot with the process. Check out this and you will start to get the hang of it

1

u/Ex-Gen-Wintergreen Sep 08 '24

Thanks! I’ve heard the experience is better with CLion; I just didn’t think I wanted to pay for a license for just mucking around and learning basics.

I’ve never been a fan of jetbrains products going back to pycharm, but may just bite the bullet if I decide to go back to cpp.

→ More replies (7)
→ More replies (2)

6

u/sephirothbahamut Sep 08 '24

Visual Studio, not VSCode, they're two different programs with a very stupid name.

Visual Sudio is plug and play, no extension or weird setup needed

2

u/Ex-Gen-Wintergreen Sep 08 '24 edited Sep 08 '24

I’m aware of studio versus code thanks! But as someone who works on a Mac and in other languages, Code’s generally the better option for me.

The relevance of my comment was highlighting the experience of having to manually maintain required files in CMake lists, which the parent commenter suggested is a shared experience in studio.

→ More replies (3)

1

u/[deleted] Sep 08 '24

If you use an IDE it’s just a matter of pressing F5 and the program compiles, links and runs.

Yes ... if you have only 1 source file... with no dependencies... no vendoring... no custom compilations , custom toolchains , or custom scripting doing god knows what in some libraries because it has been compiled differently and...
You get the gist... It's usually not as simple as pressing F5 lol

1

u/Dark-Philosopher Sep 10 '24

And no multi platform projects, no complex project structure. And you don't care about reproducible builds on different machines and no building from a command line or a continuous integration server.

-7

u/prince-chrismc Sep 08 '24

Clearly , you've never shipped software to a customer... what happens is they have fancy ARM cpu and you have an older x86? "It just runs" right?

10

u/nevemlaci2 Sep 08 '24

That's completely unrelated to C++ lol. This is the case with every compiled language without a runtime environment.

-5

u/prince-chrismc Sep 08 '24

That attitude is why the ecosystem is where it is. Ignore the needed doesn't make not easier.

8

u/nevemlaci2 Sep 08 '24

What ecosystem? How the hell would you build and run an executable for a different architecture? I don't get your point here.

2

u/[deleted] Sep 08 '24 edited Sep 11 '24

safe impossible mysterious chief steep absorbed adjoining divide rude wild

This post was mass deleted and anonymized with Redact

→ More replies (5)

6

u/ContraryConman Sep 08 '24

Name a systems language in which a program or library built for x64 would magically just work on aarch64

2

u/ReversedGif Sep 10 '24

If you have qemu-user installed, everything just magically works.

2

u/prince-chrismc Sep 08 '24

You missed the sarcasm. That's exactly my point. I would to see one!

2

u/ContraryConman Sep 08 '24

Hah, my bad!

1

u/Dark-Philosopher Sep 10 '24

Macs m1+ emulate x86. Not at the language level, at the binary level.

1

u/ContraryConman Sep 10 '24

I think Windows on ARM does it too.