Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Linked resource variables not expanded when passed to compiler
Linked resource variables not expanded when passed to compiler [message #1794336] Wed, 29 August 2018 07:24 Go to next message
dexter magnific is currently offline dexter magnificFriend
Messages: 3
Registered: August 2018
Junior Member
Hi All,

I have a problem with variables not expanding when passed as Include directories to the compiler.
Here are the steps:
1. Set some variables (e.g. SRC_LOC) in the "linked resources" page
2. In the C/C++ Settings, add an include directory using this variable (e.g. ${SRC_LOC}/inc)

When compiling, The SRC_LOC variable is empty, I see
gcc -I/inc ...


I have Eclipse CDT version 8.1.2.201302132326

Please help me solve this.

Thanks a lot.
Re: Linked resource variables not expanded when passed to compiler [message #1794459 is a reply to message #1794336] Thu, 30 August 2018 20:34 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You need to tell eclipse which project is being referenced.
You may not be able to directly use macros that aren't among the Build Variables.

You probably want to use ${workspace_loc:/<project>/inc}
Note that this uses the WORKSPACE_LOC in the resource page for <project>

When you are setting the tool options (Add Directory Path with -I for example)
use the Wokspace... button to include a directory from one of your projects in the workspace.
You will be given a list of directories within the workspace to choose from.
When you select one, it will format the macro call for you.
The following selects the inc directory in project LOCALLIB
index.php/fa/33788/0/
index.php/fa/33787/0/

[Updated on: Thu, 30 August 2018 20:50]

Report message to a moderator

Re: Linked resource variables not expanded when passed to compiler [message #1794483 is a reply to message #1794459] Fri, 31 August 2018 07:28 Go to previous messageGo to next message
dexter magnific is currently offline dexter magnificFriend
Messages: 3
Registered: August 2018
Junior Member
Thank you for the reply.
I have a problem with this: the directory I want to include is not part of any project. It is in my filesystem, somewhere in a known dir with regards to the project location.

Currently, I can workaround this by setting an include path like:
"${WorkspaceDirPath}/../../src"

WHat I'd like to do is to save "${WorkspaceDirPath}/../../src" in a path variable (SRC_LOC) and use it as ${SRC_LOC}, but this does not work.
Re: Linked resource variables not expanded when passed to compiler [message #1794790 is a reply to message #1794483] Thu, 06 September 2018 14:10 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
If the directory isn't in a workspace
then use the File System ... button instead of the Workspace ... button
when adding the include path.
See the "Add directory path" dialog above.

If you still want to make a variable
then you probably should use a build variable for SRC_LOC
Project --> Properties --> C/C++ Build --> Variables

Previous Topic:Syntax color feature request : binary logic operators
Next Topic:Photon upgrade: Errors exist in the active configuration
Goto Forum:
  


Current Time: Fri Apr 19 12:16:32 GMT 2024

Powered by FUDForum. Page generated in 0.02006 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top