cancel
Showing results for 
Search instead for 
Did you mean: 

relative and absolute paths in STM32CubeIDE

K2R
Associate II

We're working on a projekt with different µC and some so called "Common-Modules".

These commons are located side by side our projects and shall simply been linked to these.

All this could be done, but on building the project, we noticed, that no modules were built, if the include pathes were relative to the project file. Only if the path is given as an absolute path (for example like "C:\work\thiswork\module1\...") the compilation will be successfull.

As the projects will be built local and on a remote server too, absolute paths are no choice for us.

Are there any solutions to solve this?

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

>  we noticed, that no modules were built, if the include pathes were relative to the project file.

Of course this does work. A lot of people rely on this. Do you use the standard Eclipse CDT macros, such as ${ProjDirPath} ?

View solution in original post

6 REPLIES 6
Andrew Neil
Evangelist III

"if the include pathes were relative to the project file"

Presumably, then, they need to be relative to something else.

"These commons are located side by side our projects"

You could simply avoid the issue completely by having these commons within your projects.

That's the way I'd do it - for this very reason.

Pavel A.
Evangelist III

>  we noticed, that no modules were built, if the include pathes were relative to the project file.

Of course this does work. A lot of people rely on this. Do you use the standard Eclipse CDT macros, such as ${ProjDirPath} ?

@Pavel A.​ "Do you use the standard Eclipse CDT macros, such as ${ProjDirPath} ?"

Does that work for making a relative path and/or to something not in or below the Project Directory?

@Andrew Neil​ ${ProjDirPath} is substituted to absolute path on the build machine, so it is not relative, strictly speaking.

From there you can step out, for example ${ProjDirPath}/../ 

This is portable to Linux; Eclipse will automatically use correct slashes.

One can also use workspace based paths, if names of other projects included into the workspace are known.

We tried to step from the actual project like "\..\..\common", but this didn't work.

Using the macros did the trick, thanks a lot.

Regards

@K2R​ "Using the macros did the trick"

Good to hear - now please mark the solution:

0693W000008y9fZQAQ.png