Eclipse – Getting Eclipse CDT to use relative include paths in generated Makefiles

eclipseeclipse-cdtmakefile

I am using the Eclipse CDT. I have configured the "external Builder" and I am generating the Makefiles automatically. Unfortunately, the generated Makefiles contain the absolute include path. I would like to use the generated Makefiles on other systems (where Eclipse is not installed) – is there a way to make Eclipse use relative paths into the Makefile?

I have configured my projects include directory under Settings -> Tool Settings -> GCC C Compiler -> Include Paths using ${workspace_log}.

Best Answer

There is a better way to do this: "Project > Properties > C/C++ Build > Settings > Tool Settings > Cross G++ [or GCC] Compiler > Includes". Click plus button, then write:

"${ProjDirPath}/../../../somefolder1/somefolder2"

This approach allows you to specify any external folder by relative path to your project folder, even if it is located in parent subfolders.