Eclipse C/C++ project on Bash on Ubuntu on Windows

Xenofontas Kitsios picture Xenofontas Kitsios · Sep 24, 2016 · Viewed 10.5k times · Source

I've installed Eclipse Neon (v4.6). Also, I have "Bash on Ubuntu on Windows" (Sept '16). I installed gcc and gdb for compiling and debugging in C. I tested them on terminal and they're running.

I'm trying to use Eclipse to create a new C project but in the compiler selection stage it doesnt give me the option to use the "Bash on Ubuntu on Windows" compiler.

Is there any way to solve my problem?

Answer

Rich Turner picture Rich Turner · Dec 1, 2016

Because Bash/WSL is pretty new and the ability to correctly invoke Linux commands from outside Bash (using bash.exe -c ...) is not well understood by many dev tools (yet), you may have to do some work to define custom tasks/actions to call the necessary bash.exe -c "gcc ..." commands that you want to invoke.

However, you should absolutely be able to write/configure a makefile (or, perhaps even better, a CMake file) which can switch paths to lib/include/tools/etc. based on environment and then build smoothly on Windows or in Linux.

This very scenario has sparked an idea for a cool blog post that I'll work on and publish to our blog https://blogs.msdn.microsoft.com/commandline in the next week or two :)

HTH.