Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Paths and Symbols - relative shortfalls(Some problems making paths relative)
Paths and Symbols - relative shortfalls [message #1744673] Thu, 29 September 2016 12:18 Go to next message
Simon Quin is currently offline Simon QuinFriend
Messages: 5
Registered: September 2016
Junior Member
I have a folder containing multiple sources from various projects all being built together to generate a single executable. Having everything contained within a single folder and being able to have more than one copy on a PC would be very useful. So using relative paths is a pre-requisite. I have been trying to make paths defined in the "Paths and Symbols" (include tab) relative. The way to do this seems to be to use a predefined schema such as PROJECT_LOC. So something like

${PROJECT_LOC}\..\App\inc

The problem is that despite checking that the entry is resolved as expected by trying it on Resource->Linked Resource page a warning symbol is attached to the entry.

Once the warning symbol is attached to the entry it does not form part of the include list and the build fails. The only option is to enter an absolute path.

I have now given up but if anyone can assist I would appreciate it. Attached is a screen shot outlining the issue.
Re: Paths and Symbols - relative shortfalls [message #1744741 is a reply to message #1744673] Thu, 29 September 2016 19:19 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You need to understand that any relative path used by make must be relative to the make working directory when make is run.
To get an idea how that works look at how the source is referenced by the makefile in a configuration directory (like Debug).
For the Debug configuration, make will execute in directory <project path>/Debug
It will include <project path>/Debug/src/sources.mk

A typical source reference within sources.mk might be: ../src/Hello.cpp
Which in practice means <project path>/Debug/../src/Hello.cpp

However, the definition in Paths and Symbols should be relative to the workspace unless absolute.
For relative paths within the project, it would be best to use the Workspace... button.

You might also want to check if ${PROJECT_LOC} is actually defined.
In my installation, it is not. The closet thing is ${ProjDirPath}.
The variables are defined in Project --> Properties --> C/C++ Build --> Variables
A list of them is available in the drop down list obtained when pressing the Variables... button.

Edit: minor corrections

[Updated on: Thu, 29 September 2016 20:44]

Report message to a moderator

Re: Paths and Symbols - relative shortfalls [message #1744773 is a reply to message #1744741] Fri, 30 September 2016 07:35 Go to previous messageGo to next message
Simon Quin is currently offline Simon QuinFriend
Messages: 5
Registered: September 2016
Junior Member
Hello David,

Thanks for replying. I can confirm that PROJECT_LOC (and WORKSPACE_LOC etc) are present. They should always be present as they are provided by Eclipse. To check this I viewed Project->Resource->Linked Resources using the Path Variables tab. They appear in the list but may not be edited. They can be used on the Linked Resources tab. As the Linked Resource is edited on this tab the "Resolved Location" is displayed which can be used to check syntax.

My gripe is that this mechanism seems to be broken when using the Project->C/C++ General->Paths and Symbols, "Includes" tab. Path variables defined by the user in Project->Resource->Linked Resources using the Path Variables may be used but the Eclipse supplied variables may not. As the user defined variables can only be defined as an absolute path a relative project seems out of reach.

Best Regards.....Simon

Re: Paths and Symbols - relative shortfalls [message #1744789 is a reply to message #1744773] Fri, 30 September 2016 09:02 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Sorry, I got the impression you wanted something that works.
The complaint department is here: https://bugs.eclipse.org/bugs/enter_bug.cgi

Maybe they should be included among the build variables but PROJECT_LOC is not.
In fact, modifying the compile command to echo C=${COMMAND} L=${PROJECT_LOC} shows that it is treated as empty.
The only one in that tab to appear in Build Variables is ECLIPSE_HOME.
Neither are user created ones.
Actually, WORKSPACE_LOC does too but in lower case duplicated in WorkspaceDirPath


Paths and Symbols uses the Build Variables.
As I said, ${ProjDirPath} has exactly the same information.
What's the problem with using it?

Re: Paths and Symbols - relative shortfalls [message #1744791 is a reply to message #1744789] Fri, 30 September 2016 09:12 Go to previous messageGo to next message
Simon Quin is currently offline Simon QuinFriend
Messages: 5
Registered: September 2016
Junior Member
I will report the bug. I am fairly new to Eclipse and the project I am working on has a lot of components. I am afraid I have given up trying to make this project relative, I wasted too much time on this and needed a colleague to get me back to something that worked. He also said he too had tried to make this relative and failed. I take your point about ${ProjDirPath} and will certainly use this if I get some time. Meanwhile I shall just have to be very careful quite where the absolute paths point. It is very easy to run extensive tests and find that the path is pointing to a stale component.

Thanks very much for your assistance
Re: Paths and Symbols - relative shortfalls [message #1744795 is a reply to message #1744789] Fri, 30 September 2016 09:27 Go to previous messageGo to next message
Simon Quin is currently offline Simon QuinFriend
Messages: 5
Registered: September 2016
Junior Member
looks like this issue has been going on since 2008 looking at the past bugs. The answer then as now is your suggestion of ${ProjDirPath}.

I will get round to it......!
Re: Paths and Symbols - relative shortfalls [message #1744796 is a reply to message #1744795] Fri, 30 September 2016 09:37 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
It's not the only solution. You can use workspace paths as well. I've verified that they work.
Re: Paths and Symbols - relative shortfalls [message #1744797 is a reply to message #1744796] Fri, 30 September 2016 09:49 Go to previous messageGo to next message
Simon Quin is currently offline Simon QuinFriend
Messages: 5
Registered: September 2016
Junior Member
I did try that. From within Paths & Symbols, on the include tab, I clicked Add and then pressed the Workspace button. I was prompted to "Select a folder from workspace:". However I could see some folders but not others, that it is the selection is not like file explorer. I suspect that other entries are affecting this view. There seems to be some correlation with the Linked Resources view. However I cannot add to these linked resources, only edit the entries. I was hoping I could simply point at an existing folder and include it.
Re: Paths and Symbols - relative shortfalls [message #1744802 is a reply to message #1744797] Fri, 30 September 2016 10:04 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
I dunno. I was able to see and select every folder in all of the projects in my workspace with the exception of folders excluded from builds.

Are you trying to get to a folder that is outside of the workspace? Making a relative path to it assumes the project will always have the same relative location to it. Maybe not the best idea. Would be better if the project contained a link to it.

[Updated on: Fri, 30 September 2016 10:09]

Report message to a moderator

Previous Topic:"GCC" not found in path
Next Topic:Is it possible to use Win10 bash libs in Eclipse?
Goto Forum:
  


Current Time: Thu Apr 18 23:13:04 GMT 2024

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

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

Back to the top