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.

  • cerement@slrpnk.net
    link
    fedilink
    arrow-up
    16
    ·
    6 months ago
    • there’s nothing scary about the command line
      • developers like it because it can be faster, takes less work, and easier to automate
      • there’s also a whole community dedicated to getting you up to speed with Linux: !linuxupskillchallenge@programming.dev
      • that being said, on most modern distros, there’s no real need to ever leave the desktop anymore
    • and you can still use VS Code on Linux or you can go one of the open source builds of VS Code: VSCodium or Code OSS
  • Herzenschein@pawb.social
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    6 months ago

    My understanding of Linux programming is that it’s mostly done in a code editor, then compiled on the command line.

    That’s not really true. You can do that, but with most IDEs (and some text editors) you really don’t need to do that. You can do everything from the IDE.

    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 depends on the IDE and how it handles project files. Nowadays Qt Creator for example can just create your source code files and automatically add them to the generated project CMake. I’m pretty sure other IDEs or text editors have this functionality when paired with CMake or Meson too.

    It must be noted that if the IDE has some custom project file manager (like Visual Studio does with sln and vcproj files) and you use it exclusively, you’ll likely restrict your project to one platform and one IDE. Using something like CMake or Meson will make it easier to do crossplatform development and will let your users build the project without needing that specific IDE.

    Personally I like modern CMake, the problem is that you’ll see a lot of projects in the wild doing old CMake style, which is awful. Meson is okay, although it feels very Pythonic to me and lacks some features I use for Qt stuff.

  • PlusMinus@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    6 months ago

    There are IDEs for Linux as well and IMO it is unfair to compare IDE vs non-IDE workflows without also looking at the advantage in terms of automation, flexibility and the sheer endlessnes of customization options (e.g. through NeoVIM or Emacs).

    You do not have to switch to Linux to get a hang of your Linux development though. Download a 30 day trial of CLion and develop a simple application that can be run in a Linux based container.

    Regarding CMake, modern CMake not half as bad. CMake is also cross platform, you actually use it to generate your build files, your target could even be Visual Studio. For Linux it will most likely be a Makefile that you will then use to compile (with GCC or Clang) your code to objects which it will then link to create the binary.

    There are also alternatives to CMake, namely Bazel and Meson, but I haven’t used them yet.

    Once you get the hang of it, you will have a deeper understanding of the language and that will help you in the long run.

    CMake will also allow you to use Conan, that makes dependency management even easier.

  • tatterdemalion@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    6 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.

  • Dark ArcA
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    6 months ago

    You might be looking for CLion.

  • Miaou@jlai.lu
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    6 months ago

    I’m stuck working on windows at $currentCompany, and my experience with visual studio is that every other IDE I tried is:

    1. More stable
    2. Faster
    3. More intuitive UI wise (well not all but most)

    Clion is generally much more flexible and with better features.

    Regarding SLN files vs cmake, well, I’d like to know how you deal with them, because the “GUI” that vs is struggles to deal with property sheet so hard I’ve resorted to using wsl to grep for whatever files add the dependencies that I need. Also, the idea of filters to show the code in a structured would be smart if, you know, filesysyems did not have directories. Oh and with cmake adding a file does not require adding 5 GUIDs in 10 different XML files for every single configuration.

    I think the only thing I prefer in VS is that you can debut multiple targets at once, but I have not looked whether clion can do that