this post was submitted on 05 Jun 2024
22 points (100.0% liked)

C++

1763 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS
 

I have been programming in C++ for a very long time, and like a lot of us, I have an established workflow that hasn't really changed much over time. With the exception of bare-metal programming for embedded systems, though, I have been developing for Windows that entire time. With the recent "enshittification" of Windows 11, I'm starting to realize that it's going to be time to make the switch to Linux in the very near future. I've become very accustomed to (spoiled by?) Visual Studio, though, and I'm wondering about the Linux equivalent of features I probably take for granted.

  • Debugging: In VS, I can set breakpoints, step through my code line-by-line, pause and inspect the contents of variable on-the-fly, switch between threads, etc. My understanding of Linux programming is that it's mostly done in a code editor, then compiled on the command line. How exactly do you debug code when your build process is separate from your code editor? Having to compile my code, run it until I find a bug, then open it up in a debugger and start it all over sounds extremely inefficient.
  • Build System: I'm aware that cmake exists, and I've used it a bit, but I don't like it. VS lets me just drop a .h and .cpp file into the solution explorer and I'm good-to-go. Is there really no graphical alternative for Linux?

It seems like Linux development is very modular; each piece of the development process exists in its own application, many of which are command-line only. Part of what I like about VS is that it ties this all together into a nice package and allows interoperability between the functions. I can create a new header or source file, add some code, build it, run it, and debug it, all within the same IDE.

This might come across as a rant against Linux programming, but I don't intend it to. I guess what I'm really looking for is suggestions on how to make the transition from a Visual Studio user to a Linux programmer. How can I transition to Linux and still maintain an efficient workflow?

As a note, I am not new to Linux; I have used it extensively. However, the only programming I've done on Linux is bash scripting.

you are viewing a single comment's thread
view the rest of the comments
[–] tatterdemalion@programming.dev 4 points 5 months ago

How exactly do you debug code when your build process is separate from your code editor? Having to compile my code, run it until I find a bug, then open it up in a debugger and start it all over sounds extremely inefficient.

There's a lot of incorrect assumptions baked into this. While you may choose to invoke your debugger separately from your editor, many modern editors support the Debug Adapter Protocol (DAP). This is a protocol developed by Microsoft for VSCode, and the VSCode debugger is quite powerful. I've only used Visual Studio many years ago, but from what I recall, the VSCode DAP is essentially just as powerful. And if you're not interested in VSCode, the Helix editor and probably NeoVim also support DAP.

how to make the transition from a Visual Studio user to a Linux programmer

You are also coming in with the constraint of programming in C++. For this specific language, I think I agree with others here that either CLion or VSCode+CodeLLDB are your best options today. Maybe after you get comfortable in the Linux environment, if you want to try something more keyboard-centric, install a Vim emulation plugin or even jump right into Helix or NeoVim.