4.2.1. Eclipse Managed Build
To begin with, this can be the simplest way to build a new Project. (But it only works with GCC and other Eclipse supported tool-chains.) [1]
CDT gives a GUI to:
- Manage the build
- Selectively exclude/include some files from build.
- Maintain build configurations
- Indexing works out-of-the-box
With Eclipse managed build, Eclipse can automatically create a set of makefiles. These make files can be used with standard make utility. Thus, if the project is managed within Eclipse, developers not using Eclipse can still build the software. It is also useful for automated standalone builds.
Note
Older versions of CDT used to refer this as a Managed make project
4.2.1.1. Creating a sample project
Click File ? New ? Project
Select C Project
![]()
Name the project as Hello World.
Select project type as Hello World ANSI C Project
Select Tool-chain as MinGW GCC
![]()
Click Next button
Input your details
![]()
Click Next button
Select Advanced settings
![]()
Select Current builder as Gnu Make Builder
![]()
Click OK button
Click Finish button
If you get a message to switch perspective, Click Yes
![]()
This happens if the previous perspective was not C/C++ perspective.
This is how the Project Explorer view would look like.
![]()
- The name of the project HelloWorld
- Eclipse would list executables and libraries of the project here.
- Eclipse would list include directories and header files here.
- Eclipse generated folder. The name is derived from the build configuration.
- Eclipse generated Makefiles
- The actual source file.
To build the project, do either of:
Press Ctrl + B
Click Project ? Build All
Press the Build Button
![]()
4.2.1.2. Build Configuration
Build configurations are different ways of building a code. The most basic would be Debug mode and Retail Mode. In Debug mode, the generated objects and executables have Debug symbols. For large projects, this can become further complicated. Including files for test code, excluding files for test code, etc.
Each configuration can have unique set of source files, includes, #defines, and other compiler/linker parameters.
4.2.1.3. Changing Build Settings
Eclipse gives control over how the project gets build.
4.2.1.3.1. Include / Exclude Files from Build
Use Right Click ? Resource Configuration ? Exclude From Build to add/remove a source file from a Build Configuration
Even finer control can be achieved through, Project ? Properties ? C/C++ General ? Paths and Symbols ? Source Location (See Including / Excluding files & directories from build)

Including / Excluding files & directories from build
4.2.1.3.2. Compiler Directives
Through Project ? Properties ? C/C++ General ? Paths and Symbols ? Includes we can Add include paths to build.

Add include paths to build
Through Project ? Properties ? C/C++ General ? Paths and Symbols ? Symbols we can Add compiler defines to build.

Add compiler defines to build
4.2.1.3.3. Change the Make Utility
To Change the default build utility, from make to something else, go to Project ? Properties ? C/C++ Build ? Builder Settings

Change the default build utility
To change Advanced build settings , e.g. using Parallel jobs for build (-j), or build on every save, go to Project ? Properties ? C/C++ Build ? Behaviour

Advanced build settings
4.2.1.3.4. Advanced toolchain specific settings
The tool-chain can be selected form Project ? Settings ? C/C++ Build ? Tool Chain Editor.
To Change general settings of the Tool-Chain, like, enable warnigns (-Wall), don’t include standard system header files during compilation (-nostdinc), etc. go to Project ? Settings ? C/C++ Build ? Settings ? Tool Settings

Change general settings of the Tool-Chain
We can also Change the build artifacts (dll/lib/exe). We can control if we want to build a DLL/Shared Object, static library, or an Executbale out of this project.

Change the build artifacts (dll/lib/exe)
4.2.1.3.5. Pre-Build and Post-Build Steps
To Add pre-build and post-build steps, go to go to Project ? Settings ? C/C++ Build ? Settings ? Build Steps

Add pre-build and post-build steps
[1] | Cygwin GCC, Linux GCC, MacOSX GCC, MinGW GCC, Solaris GCC are supported by default. The Proprietary distributions based on Eclipse would also support the toolchains of that distribution. |