simple Windows c++(python)set-up #Intellj is better4java

See also easiest windows GCC installer #c++17

Git-Bash + StrawberryPerl is the best combo for me on Windows. I put g++ commands in bash scripts to automate my GCC build and test. Note my typical project has at most 20 source files.

Git-Bash + StrawberryPerl + Notepad++ is better for me than any c++ IDE like Eclipse CDT (4 installations), Bloodshed (4), CodeBlocks (1), NetBeans…

  • I don’t need code completion..
  • I don’t need jump into a type definition.
  • I don’t need my debugger to be visual. StrawberryPerl includes gdb
  • I use Notepad++ for text search across hundreds of files
  • I use Notepad++ for search/replace
  • I use diff and git-diff to see code changes
  • I used github for version history

I’m such a die-hard fan of command line that the only GUI development tool I use is notepad++ and it’s optional. Since 2015, my Linux c++ code editor has been VIM, which I used on large codebases consisting of 1000+ source files.

For about 2 years EclipseCDT was my default choice, then the simpler Bloodshed became my default choice as it is simpler than EclipseCDT. However they are still over-complicated. I didn’t have a favorite until 2017, when I discovered Notepad++/Git-Bash/StrawberryPerl

Q: why do I use Eclipse for Java but not for c++?
A: Eclipse is more problematic, more messy for c++ than for java. The benefits (convenience, automation..) is offset by the high TCO (total cost of ownership). For example, java debugger, java code navigation, java renaming/refactor all work better than c++.

Q: how about MS VisualStudio?
A: I managed a large c++ codebase on MSVS 2015 in 2015-2016, about a year+. Too complicated, worse than MSVS for c#. I would never prefer it over my command line set-up, if given a choice.

By the way, Git-Bash works well with a standard python installation, but I do recommend the tweak at

waste time@c++IDE

c++ IDE build is 20% (up to 50%) more complicated than java, partly because c++ compilation is more complicated than java. Another reason is my previous investment in learning java compilation.

It can take many hours to fix an IDE project, but the long term return and leverage is questionable, since I use c++ IDE much fewer than java IDE.

Eclipse is my choice, although there are many usability issues and apparent bugs. Far from ideal.

Experience — devcpp is simpler.

Experience — codeBlocks xx isn’t worth the effort


[15]Eclipse C++11/mingw xp

The default mingw download is too old for c++11. I tried mingw-builds project. Hit some problems. Probably failed to install or something else.

mingw-w64 — I found some workaround using a gcc 4.9 build — good for c++11. This 32-bit version worked in win7 and winxp —\

Note this is not an installer. When I tried the installer of mingw-w64 , it could (!) compile my c++11 code on the command line, but CDT couldn’t detect mingw gcc. Even after I cloned mingw32-gcc.exe, i still faced issues with #include . These are all well-known issues on the internet. Clearly this mingw-w64 installer isn’t better than the 7z download.

Lessons learnt –
* no need to upgrade. If your installation is a few years outdated, it may still work perfectly.
* standard installers may be “proven” for common tasks only, and a non-standard download could be high quality.
* Consistent with my past experience, env set-up is time consuming, esp. on the bleeding edge. In this case, both CDT and mingw have more than a single unified, consolidated release stream. Some users download from stream ABC and follow the versions therein. Other users download stream XYZ. Hard to share technical problems. Many of my installation issues were complicated by this “proliferation”.
* java (and py, c#) are easier since a single vendor releases all the versions

Eclipse CDT + gdb setup


PATH is a per-project config, not optional.

CCB->settings->toolSettings->g++compiler->misc -> turn on verbose to see which g++.exe in use
–c++11 mingw
mingw-builds installer either errors out or was too old… I  used mingw-w64 instead

install mingw and fix %PATH%. Go to mingw\bin\ folder. In dos, verify
g++ –version // gcc is the C compiler !!
gdb –version
copy the *make.exe to make.exe // needed in some of my projects
make –version
Even without IDE, I believe mingw g++/linker can convert your c++ source into executable. Mingw is designed to be usable without IDE. Both codeBlocks and eclipse users generally favor mingw over cygwin.

(Note you need the eclipse view “C/C++ projects” to see the Binaries + related stuff)

project properties -> Builders — I didn’t change.
project properties -> c/c++ general (CCG) — no need to change.
project properties -> c/c++ build (CCB) — contains every important config for C++. Amidst the CCB config maze, #1 factor is tool chain ( CCB->toolChainEditor ). Eclipse often defaults to CrossGCC + CDT_InternalBuilder [3]. Leads to this Question

Q1a: is that enough? mingw unnecessary?
A: I thought “Sometimes Partially Usable”, but I guess it’s an illusion, and we still need mingw.

Q: does eclipse come with gdb, so we don’t need to install mingw?
A: probably not. Apparently, gdb.exe must be in %PATH%

[3] To remind you which builder is in use, build console says “…. builder is used”

Now that’s the preliminary. Let’s zoom into compiling and debugging your project.
Q1b: does eclipse come with g++ compiler?
A: probably not. Eclipse looks for g++.exe in %PATH%, failing which it always always always fail to build.

Fix 1) First install mingw. Usually you can but sometimes can’t build using default crossGCC, in which case change toolChain=mingw (usually not needed). Should build a [projectName].exe, just as msvs. Runnable in dos.

Surprise #1 — by default, there’s no debug config for your project. I think that’s why you can build a good executable but can only run it in dos, not F11 — you get BinaryNotFound. That leads to …

Fix 2) create a debug config [2], in Run->RunConfig->c/c++App->new. Mention your [projectName].exe. If it’s not recognized as IDE-runnable, You may need to mess with the CCB->Settings->binaryParser (PEWindowsParser?) and restart IDE, rebuild…. Now you can run it in IDE, but you may or may not have problem debugging it. That leads to another Fix and Q&A

Fix 3) –>
Q: Minimum effort to fix debugging?
A: CCB->ToolChainEditor->currentToolChain = mingw. You can leave InternalBuilder alone.

[2] a debugConfig is also a runConfig.

Eclipse CDT copy-create project

Project Copy-create is easier than create-from-scratch. However, the new project is often broken, perhaps due to multiple CDT bugs:-(. Since CDT is buggy, i prefer external diagnostic tools.

* External — the exe file. ….\ideWorkspace\yourProject\Debug\*.exe. I call it “the EXE of the project”
Each clean-rebuild should recreate this file with a new timestamp. You can delete the file directly. If your main() ends with cin.get(), then you can run the EXE by double-click.

—– now, let’s look at how to copy-create —-
The copy actually copies the .exe as the EXE. I hate that name, so I run a text replace in
ideWorkspace\yourProject\.cproject. You need to reopen the project, clean and rebuild, then refresh the view to see the newly produced EXE.

You may need to create a run-config. To search for the EXE, use the browse button. However, CDT might say the EXE is not a recognized executable [1]. Occasionally You can ignore it and run the EXE externally, or through the run-config.

[1] If you prefer to fix that, change the project properties -> c/c++ build(CCB)->toolChainEditor->currentToolChain to minGW.

basic eclipse c++ Q&&A

Q: project rebuilding — the exe is permission-denied
A: perhaps the debug shows the exe still in use.

Q: funny/weird characters in error messages and tooltips?
A: define environment variable LANG=en_US.ISO-8859-1 in Window->Preferences->C/C++->Environment
A: In toolchainEditor (TCE) if you chose cross GCC, you can get cleartext error messages. You also see Includes in Project view

Q: binary not found
Maybe there’s nothing for this Project under runConfig? Your *.exe (full path) should show up.

Q: basic includes for every *.c file?
using namespace std;

Q: “This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information.”
A: perhaps you access argv[1] without any command line arg?

Q: where’s the *.exe file generated for my project?
A: in the Debug folder

Q:’strlen’ was not declared in this scope
A: #include

Q: undefined reference to `WinMain@16′
A: no main()

Build simple boost project]EclipseCDT^codeBlocks has a simple program using Boost Lamda.

1) immediately clean the project. Eclipse will rebuild and fail due to include path

2) Project -> Properties -> CCG -> pathsAndSymbols -> Includes -> GNU_C++ -> Add -> file system …
…I took the laziest route and simply put in “C:boost_1_44_0” to ignore all checkboxes, and it worked. I used a forward slash and it worked too. However, I removed it and put in “C:boost_1_44_0” and checked all 3 checkboxes -> compiler can’t resolve “#include “

(msvc procedure is well-documented.)

codeblocks is easier with include path — Project -> BuildOptions -> SearchDirectories -> Compiler -> Add