Relative paths to include files in Eclipse CDT

The structure is like this:

subsystem
  sub_dir
  sub_dir
  ...
  new_sub_dir_for _unit_test_which_includes_eclipse_workspace 
     Debug       <===   this, I think, being  ${workspace_loc} 
                        or is the parent directory ${workspace_loc}?
                        (since it contains .project and  .cproject)
     test_cases
     stubs
  file_1.c
  file_1.h
  file_1.c
  file_1.h
  ...
  software_under_test.c
  software_under_test.h

      

software_under_test.c

says #include "../somefile.h"

it is obviously outside of this subsystem.

When I set up my include path with Properties/C & C++ general/paths and symbols

, I cannot use a relative path, just an absolute one, which I don’t want to do as I want others to be able to build this project on their machines and the start of the path can vary for each user.

I've tried adding ${workspace_loc}../

variations of it as well, but I can't seem to get it to work.

What am I doing wrong?

+3


source to share


1 answer


Are you using the variables parameter while viewing the location?

When adding the path to the include file in the CDT project (Project Properties / C / C ++ General / Paths and Symbols) there are 3 options for finding the location:



  • Variables
  • Workspace
  • File system

Select the "Workspace" option, the path will refer to the workspace / project. Select the "Variables" option, you will be able to use variables such as ${WorkspaceDirPath}

. You should be able to even reference environment variables.

+2


source







All Articles