Getting Eclipse CDT to use relative include paths in generated Makefiles

13,424

Solution 1

If you use relative path in the 'include paths' (instead of ${workspace_loc}), then the makefile (and .mk files it uses) will include relative paths as well.

Solution 2

The relative paths you add in "Project > Properties > C/C++ General > Paths and Symbols > Includes" tab are relative to your project folder.

The ones that appear in the generated makefiles are relative to the main Makefile location.

Share:
13,424

Related videos on Youtube

Nikratio
Author by

Nikratio

Updated on May 06, 2022

Comments

  • Nikratio
    Nikratio about 2 years

    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}.

    • dtmland
      dtmland almost 9 years
      The accepted answer below works for include paths in the project, but what about linked resource files? My generated makefile still contains absolute paths sources files. Do you not use linked sources in your project? How can you compile on other systems?
  • CashCow
    CashCow over 10 years
    Relative from where though?
  • dtmland
    dtmland almost 9 years
    By chance do you how to achieve the same for linked source files? They are still being set to absolute in my generated makefiles?
  • Itamar Katz
    Itamar Katz almost 9 years
    No, sorry... I haven't worked with Eclipse in about 4 years.
  • huseyin tugrul buyukisik
    huseyin tugrul buyukisik over 5 years
    .Same problem here. Linked resource, move project to another machine, it fails because of absolute path for linked resources (.h files).