{"id":551,"date":"2017-10-29T11:01:28","date_gmt":"2017-10-29T10:01:28","guid":{"rendered":"http:\/\/systev.com\/?p=551"},"modified":"2019-06-09T20:05:32","modified_gmt":"2019-06-09T18:05:32","slug":"importing-c-projects-into-eclipse-cdt","status":"publish","type":"post","link":"https:\/\/systev.com\/importing-c-projects-into-eclipse-cdt\/","title":{"rendered":"Importing a C project into Eclipse CDT"},"content":{"rendered":"

I’m currently writing some C code. I have chosen to use Eclipse CDT<\/a> as IDE. Eclipse is very powerful, but configuring it in the right way when starting a project can be complex. This article describes steps I followed to import some existing C code, creating a managed project. It is assumed that the reader has a basic knowledge of Eclipse.<\/p>\n

Context<\/h3>\n

For what follows, we will work with some sample code, stored in following file hierarchy:<\/p>\n

\"\"<\/p>\n

Header files are stored in include<\/tt> directory, while source code is stored in src<\/tt> directory.<\/p>\n

I’m using Eclipse Oxygen 1a Release,<\/em> on Linux Mint 18.2<\/em>.<\/p>\n

Note: the code I develop must be portable. The first version I write targets Linux on Intel processor. That’s why I’ll use Linux GCC toolchain in what follows. Then, when I’m happy with the version running on Linux, I check that code works OK on other targets (FreeRTOS on STM32, Arduino, etc.) Of course, every OS- or hardware-dependent code is isolated and adapted to related target.<\/p>\n

Importing source code<\/h3>\n

I want to import the existing source code into Eclipse, creating a managed project,<\/em> i.e. a project where makefiles are automatically generated and maintained by Eclipse.<\/p>\n

To do this:<\/p>\n