6 ms·
Can anyone recommend a good compiler/IDE learning setup? I studied C and C++ back in university (I was in the wave of students that came through after they swi
by StevePerkins 9y ago
Can anyone recommend a good compiler/IDE learning setup?
I studied C and C++ back in university (I was in the wave of students that came through after they switched from Pascal as the teaching language, and before they switched to Java). And my first job or two back in the early-2000's was using C++ in HP-UX servers, to talk to other systems via CORBA.
But that was ages ago, and once I stumbled into a Java job I never left. Every so often decide to scrape off the rust and check out C++ again, but the ENVIRONMENT setup scares me off.
Should you use GCC or LLVM? If you're on a Windows box, do you try one of those? (there's at least three different distributions of MINGW available) Or do you use Microsoft's compiler? (VS has potential licensing issues, while the freeware build tools are pretty arcane and it's hard to even find an installer or know which exact thing to install) Or Cygwin? (I'm not 100% sure on the current state of its licensing)
I've tried to build the wxWidgets library at least 100 times. It gives you dozens of options for compiler and environmental setup, and yet I've never found a choice that successfully built all the sample apps.
Once you have a compiler setup, what about an IDE? (Don't even start with the "just use Vim or Emacs" crap, I'm not an animal!) I love IntelliJ in the Java world, but don't want to pay for JetBrains CLion just for hobby/personal use. The last time I tried Eclipse's C++ support it felt pretty half-baked. Qt Creator is actually really nice IDE (a C++ IDE should be written in C++!), but it feels very specific to writing Qt apps.
What about build tools? It's hard enough for Java newbies to wrap their heads around Maven or Gradle. But makefiles and "configure" scripts are far more arcane, and which flavor of make should you be using in 2017? It's hard enough to build a project that uses one of these large frameworks with opinionated build systems. I wouldn't even know where to begin in combining two opinionated build systems as dependencies of a single project, or creating a new build system from scratch for a greenfield large project.
Once you have a compiler, IDE, and build system and are ready to start coding, what about a standard library? Is Boost still the thing everyone uses? STL? Something else?
I really can't imagine that learning C++ syntax is THAT challenging in comparison to Java/C#, Rust, D, or anything else. But I'd love to see an "Effective C++ Environment" book.
- pjmlp 9y ago> If you're on a Windows box, do you try one of those? No, I just use Visual Studio. If you don't want to pay for it, there is the Visual Studio Community edition available for free for personal use, which is basically Visual Studio Professional re-branded with a different license.
- linkmotif 9y agoI don't know C++ but I think a good way to address these questions is by checking popular C++ projects on GitHub. I'm a solo developer and have learned a ton in terms of "lay of the land" type stuff seeing what people do in other projects. GH has been invaluable to me.
- 0xfeba 9y agoThis was/is the biggest gap in my knowledge. Setting up cmake, or make, or the autotools on Linux, or setting up cmake and Visual Studio (the configuration options) was always a big stumbling point for me. I've only gotten the hang of it through trial and error, it seems like tutorials and documentation just lacks the connection to why you need to set things up a certain way.
- Tomis02 9y ago> Setting up cmake, or make, or the autotools on Linux, or setting up cmake Don't do this to yourself, just stick with regular Visual Studio and its build system. Nowadays you can even use it to build Linux binaries, so why put yourself through the hassle of using stone age text files to configure your build when Microsoft has been providing a perfectly usable solution for almost two decades? https://www.theregister.co.uk/2016/03/31/microsoft_visual_studio_c_plus_plus_for_linux/ https://www.theregister.co.uk/2016/03/31/microsoft_visual_st...
- z0r 9y agoWhile it's not representative, the last time I touched Visual Studio was to work on fixing bugs in software that had to be deployed to an Xbox 360. Let me tell you, the process for that involved nasty build settings and a small constellation of batch files and it was not especially usable. Text files aren't "stone age", they are the past and I would always bet on them being the future.
- Tomis02 9y agoWithout knowing the specifics of your software I can't really tell if the problem was with Visual Studio or the process itself. I do believe you can have a shitty work environment whatever you use, and that some tools aren't good for every job (and that includes Visual Studio). > Text files aren't "stone age" The issue is whether your build system provides you with an UI that enables you to be productive (e.g. Visual Studio), or if it forces you to manually edit some configuration files using some arbitrary syntax that doesn't seem to display any sort of internal logic (e.g. CMake). In this respect, being forced to deal with text files is stone age, just like debugging a C++ program with stock GDB. In the end, it's a matter of preference. Do you want an IDE so that you can focus on programming, or do you want to set up and maintain a string of loosely coupled tools that, when the stars align, do what you want to.. kind of.
- jhasse 9y ago> Should you use GCC or LLVM? GCC still compiles faster and produces faster binaries for me. But I like to swap to clang once in a while since it has better compiler messages (always use -Wall -Wextra). > If you're on a Windows box, do you try one of those? (there's at least three different distributions of MINGW available) Or do you use Microsoft's compiler? (VS has potential licensing issues, while the freeware build tools are pretty arcane and it's hard to even find an installer or know which exact thing to install) Or Cygwin? (I'm not 100% sure on the current state of its licensing) Instead of Cygwin you should check out MSYS2: http://www.msys2.org/ http://www.msys2.org/ It has a package manager which can install both GCC and LLVM. > I've tried to build the wxWidgets library at least 100 times. It gives you dozens of options for compiler and environmental setup, and yet I've never found a choice that successfully built all the sample apps. Check out this wxWidgets project of mine: https://github.com/jhasse/pwcalculator https://github.com/jhasse/pwcalculator It should build on all operation systems, if not please create an issue and I will take a look :) > Once you have a compiler setup, what about an IDE? I'm using Visual Studio Code with the C++ extension (on both Linux and Windows). > What about build tools? I'm using Waf (and SCons for older projects), mostly because I also like Python. In my experience you should avoid qmake, most others are fine. > Once you have a compiler, IDE, and build system and are ready to start coding, what about a standard library? Is Boost still the thing everyone uses? STL? Yes, both are pretty popular. Nowadays the STL covers most of the older Boost stuff (e.g. shared_ptr, thread, regex, ...).
- Shikadi 9y agoI'm so excited that there a cygwin based tool with pacman built in! Thanks for the suggestion!
- kabdib 9y agoOn Windows, just use Visual Studio. It's free (one of Microsoft's better decisions of the last few years) and it's pretty damned good. Resist the temptation to switch tools a lot, or tweak things continually with plugins or code generators or whatever. I've seen people do this; they get distracted by tooling and tend to learn more slowly. All you really need to do is sit your butt in a chair in front of a good C++ compiler/debugger, and stock VS without any tweaks fits that perfectly.
- to3m 9y agoYou do need Comment Reflower.
- kabdib 9y agoNobody I know uses it. On the other hand, the Whole Tomato refactoring tools are pretty awesome, and most of my cow-orkers have them installed. They make large projects a lot easier to deal with (near instantaneous search across a large project is a wonderful thing). But you don't need them, especially when you're starting out. My basic principle is, when learning a language, doing stuff that isn't involved in learning that language is, well, not learning the language. It's like the aspiring writer who just needs to find the right laptop, the right software, the right printer / coffeeshop / corner of the house . . . it's all excuses and procrastination, just sit down and write.
- Tomis02 9y agoI second Visual Studio, since it has a decent debugger (light years ahead of GDB when it comes to usability) and is relatively user-friendly (almost everything is customizable, but there are sane default values). I recommend starting a blank C++ console project and adding files as you go, otherwise you risk getting confused (e.g. "what the hell is stdafx.h and why is it included by default in my main file") and trapped by Microsoft's ecosystem. > What about build tools? It's hard enough for Java newbies to wrap their heads around Maven or Gradle. You don't have to worry, Visual Studio has everything integrated. There is a build system (MSBuild? last time I checked) that you could theoretically use outside of Visual Studio, but you probably don't even need to be aware of its existance. Also, if you do Android development, Visual Studio abstracts Gradle away, which is basically the way development is supposed to be done.
- 0xFFC 9y ago>Qt Creator is actually really nice IDE (a C++ IDE should be written in C++!), but it feels very specific to writing Qt apps. No it is not, I use QtCreator 99% of times with CMake projects. QtCreator with ClangCodeModel is the best you can get. Nothing even comes close to this combination. I have to say I am obsessed with IDE's, and I have tried all of IDE's you mentioned, nothing can even come close to QtCreator. The only drawback is when you use ClangCodeModel in Windows. It seems there is problem of Clang Parser in windows (there was a serious discussion with Clang developers on their mailing list). Parsing and Autocompletion are slow in Windows platform. But it is completely fine in *nix, OS X.
- kitd 9y ago> Can anyone recommend a good compiler/IDE learning setup? Given your post, I'm assuming Windows. There's BloodShed Dev-C++ which has Mingw-GCC bundled but you can use another. [1] Then there's Code::Blocks, which has a Mingw-GCC bundled version - [2] One IDE that impressed me recently was CodeLite [3]. It doesn't come with a compiler, but its support for GCC is very good, especially gdb. You mention wxWidgets and IIRC it has built-in tools for that as well. [1] - http://www.bloodshed.net/devcpp.html http://www.bloodshed.net/devcpp.html [2] - http://www.codeblocks.org/ http://www.codeblocks.org/ [3] - https://codelite.org/ https://codelite.org/
- sqeaky 9y agoI didn't downvote you but I suspect you got downvoted because DevC++ is super stale. Their last release was pre-C++11 and likely more than a decade ago.
- deleted 9y ago[deleted]
- slavik81 9y agoApparently there's a fork by Orwell (Johan Mes) updated in 2015 which does support C++11. I still wouldn't use it, though.
- joshvm 9y agoOn Windows, just use Visual Studio Community. You don't need anything else, Microsoft's support for C++11/14/17 features is excellent. I'm not aware of any killer licensing issues with the free version, the only limitation is that if you're an enterprise (> 5 users, > $1M revenue, that sort of thing) you need to buy a license. There isn't a problem with commercial development using the free version. You may also need to provide the VC++ redistributable with your application though. As for standard libraries, the STL is the standard library and you 'should' use that where possible. Boost is a mix of potential features for C++, a few modules that lots of people rely on (e.g. json, timers, asyncio), and a whole lot of undocumented and unmaintained code. I get by without it most of the time. Qt Creator is pretty decent even if you don't use Qt. You can use the qmake system which does lock you in somewhat, but it's easier to configure than cmake for a newcomer. You still get debugging/profiling and intelligent autocomplete/linting. If you don't mind the large library overhead, you can use Qt for a lot of brick-and-mortar code like dealing with filesystems, sockets/serial comms, parsing XML, etc. It's very well documented, updated often and it's GPL which is nice. Or you could statically link it. Personally I've found the Qt GUI framework much more intuitive than the native Windows stdafx stuff.
- netheril96 9y agomake and configure and autotools are things of the past. You should learn cmake, but only after you have already familiarized yourself with C++ with Visual Studio Community Edition. Don't use gcc or clang on Windows as I have had been bitten by their bugs for a lot times. Always use the native tool on that platform or you will face constant headaches (VS on Win, GCC on Linux and Clang on macOS).
- almonj 9y agoI use this command for widgets with mingwx64: mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1 USE_OPENGL=1 CXXFLAGS=-fno-keep-inline-dllexport works on multiple machines for me, I write openGL GUI apps.
- nazka 9y agoLike everybody go with Visual Studio. If you have to be on Mac then maybe you can go with XCode or else for Linux Qt Creator. I never tried CLion from JetBrain but it can be good too.
- z0r 9y agoRun some friendly flavor of linux in a virtual machine and do your C++ inside of it. Serious and not sarcastic advice. There's nothing to be afraid of, it isn't really that hard, you just need patience.
- ensiferum 9y agoOn Windows save yourself a bunch of headaches and just use visual studio. On Linux either gcc or clang will get the job done. The biggest headache in the C++ ecosystem is by far building large cross platform projects. All the existing build tools suck. https://giantfublog.wordpress.com/2016/10/15/portability-in-c-is-a-joke/ https://giantfublog.wordpress.com/2016/10/15/portability-in-...
- malkia 9y agoI've spent my first 15 years in video games, then 2.5 years in Google, and I'm moving again to video games. I'll stick to C++, IDEs and BUILD files. Before any project, it was Turbo/Borland Pascal and TPU files. No real projects, but it was very easy to use a module, no header files, just "Use Something;" done. C# carried that in there, and Java too. Then for C++ it was first a simple text files with what to compile, later Makefiles (I still love them), .vcproj, .vcxproj/.sln, scons, cmake, qmake, qbs, custom tailored makefiles, etc. I've never found any of these good, until I used Blaze (Bazel on the outside) at Google (alternatively generate-ninja (gn) for Chromium/Fuchsia, close but not the same). So what do I like about BUILD files, Bazel and WORKSPACES? It's simply this: cc_library( name = "my_lib", srcs = [ "one.cc", "two.cc" ] # has glob() too hdrs = [ "one.h", "two.h" ] deps = [ "//base/something:project" ], # // is like a root for all projects. ) No transitive dependencies, e.g. if A depends on B, B on C, A can't use "C" just because B did. A also needs to declare it. It takes a while to convince yourself, but then it becomes clear why this is done so. Bazel (blaze) gets a little bit harder to use if you target different platforms (say ps2, ps3, ps4, xbox, wii, pc, etc.), but there is way to declare that, in this respect GN is much easier, just use "if (is_pc) {}" in the declarations (they are BUILD-like), and you are done. I just bought the IntelliJ package /yearly, got CLion, also some other things, and started using it for home projects. It comes with bazel support (plugin), so that helps. -- On the other hand there is QtCreator, Visual Studio (the current free version is almost like professional except CodeLens), then some more experimental ones like the Juce's Projucer, and plenty more.