4 ms·
Others have talked about how to learn the language but many people often find that hardest thing to do is to even compile their first C++ file. This is the "bui
by elteto 9y ago
Others have talked about how to learn the language but many people often find that hardest thing to do is to even compile their first C++ file. This is the "build system escalation policy" that I personally use, depending on what I need:
1: Experimental, throw-away code: online IDEs or Godbolt if I care about compiler output. You would be surprised how much mileage you can get out of a simple online IDE when you are just learning or exploring a new thing and don't care about preserving your work.
2: Single-file code or small multi-file projects with no dependencies (like exercises or code samples from a book): direct calls to clang++/g++ in the command prompt or a simple build.sh shell script when I have to build multiple files. Make is a fantastic tool for this so you can learn and use that instead. I would actually encourage beginners to play directly with the compiler and learn the basic flags though, but this is personal preference.
3a: Personal projects that pull in other dependencies (either system wide or libraries from github or other sources): Make or cmake would probably work here equally well. I actually prefer cmake for its find_package and external project functionality. Notice the jump in complexity from 2 to 3, this is something you have to deal with and eventually you will have to pick a build tool and learn it.
3b: After learning to use Bazel I have mostly migrated to it for all my personal projects, but there was an initial learning curve for sure (not worse than cmake though).
4: At work: Whatever your company/team/group uses, you will most likely have little input on this if the codebase is old and established.
If you are in Windows you can use vanilla Visual Studio C++ (Community edition is free and has all the bells and whistles) for 1-3, or use Visual Studio + cmake (you can generate VS solution files from cmake).