Porting a VS project to Eclipse CDT (C++)

Few days ago I tested Eclipse C++ (see here) and was actually pleased with the results. Today in office I needed to work with a C++ pipeline tool and decided to convert it to Eclipse C++ while I was working on it.

Overall it went really smoothly and I like Eclipse C++ more and more. Here are the few things I needed to do.

  1. To edit your project building properties, go into the “Project Explorer” panel on the left, right click your project and select “properties”. Then unfold “C/C++ Build” and select “Settings”. The good thing is you can edit both debug and release configurations to set identical settings, so in the “Configuration” drop down select “[ All Configurations ]”
  2. There is no #pragma comment(lib,”mylib.lib”) to link with libraries. So make sure you go to “MinGW C++ Linker” then “Libraries”. Add the name of the library without .a nor .lib in “Libraries”, and add the path in “Library search path”. The specific project I worked on used DevIL the image library and the linker had no problem linking with the provided libraries. Again the trick is to remove any suffix from the library name. If you enter Devil.lib into the settings, the linker will complain about not being able to find the library. Change that to Devil (without .lib) and the linker will find it.
  3. If you compile your project with default settings you will most likely need to ship it with libraries like libgcc_s_dw2-1.dll or libstdc++-6.dll, so again in the settings page, go to “MinGW C++ Linker” then “Miscellaneous” and in the linker flag box add -static. This will increase a bit your executable size but will make it easier to deploy and overall will be smaller than shipping with all the Dlls needed.

Overall I already made two small projects with Eclipse CDT this week and it went as smoothly as it should, and as smoothly as VS, so the next test will be a project with more Windows / DirectX specific code. But so far, Eclipse CDT seems like a perfectly viable free alternative to VS.

Leave a Reply

Your email address will not be published. Required fields are marked *