cancel
Showing results for 
Search instead for 
Did you mean: 

Nightmare on Linked Resource street!

Robmar
Senior III

I added a Linked Resource and tested it on an include line, although the path is the same, it fails.
I have zero idea why, does it need another syntax?

Path variable:-> REPOSITORY_LOC set as C:\Users\Dev\STM32Cube\Repository

With GCC Copiler Include Paths this fails:- ${repository_loc}/STM32Cube_FW_H7_V1.11.1/Drivers/STM32H7xx_HAL_Driver/Inc

but this works:-

C:/Users/Dev/STM32Cube/Repository/STM32Cube_FW_H7_V1.11.1/Drivers/STM32H7xx_HAL_Driver/Inc

I tried with '\' and '/' no difference.

Why would this cause these errors:-

C:/Users/Dev/STM32Cube/Repository/STM32Cube_FW_H7_V1.11.1/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h:282:11:
fatal error: stm32h7xx_hal.h: No such file or directory

282 | #include "stm32h7xx_hal.h"

| ^~~~~~~~~~~~~~~~~

8 REPLIES 8
Andrew Neil
Evangelist III

@Robmar wrote:

 

C:/Users/Dev/STM32Cube/Repository/STM32Cube_FW_H7_V1.11.1/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h:282:11:
fatal error: stm32h7xx_hal.h: No such file or directory


So it can't find the file stm32h7xx_hal.h.

Use the Windows File Explorer (or whatever) to find if/where that actually exists on your hard drive

  • If it doesn't exist, then no amount of fiddling with the project settings can fix that.
  • If it does exist, make sure that location is in your Include Paths.
    Easiest way to do this is to find the folder in the CubeIDE Project Explorer, right-click it, and choose 'Add/remove include path'
TDK
Guru

Path variables are an Eclipse convention. Are they properly expanded before being passed to the compiler/linker? Show the full output of the Console tab so we get the full picture of what's going on. I doubt they're case sensitive, but that seems like an easy thing to get consistent.

If you feel a post has answered your question, please click "Accept as Solution".

As I wrote, with the linked path name "repository_loc" replaced with the same path text it works.

The problem is that the path name is the exact same path string, so why does it fail when the linked path "repository_loc" is used, as they are the same?

It all links perfectly until I add the linked resource path as indicted above and used it in an include.

Using the include path below, it throws up errors for the CMSIS directory**

${repository_loc}/STM32Cube_FW_H7_V1.11.1/Drivers/STM32H7xx_HAL_Driver/Inc

Error:-> **C:/Users/Dev/STM32Cube/Repository/STM32Cube_FW_H7_V1.11.1/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h:282:11: fatal error file not found

repository_loc is set to C:\Users\Usuario\STM32Cube\Repository

If I put the include as: C:\Users\Usuario\STM32Cube\RepositorySTM32Cube_FW_H7_V1.11.1/Drivers/STM32H7xx_HAL_Driver/Inc then it all works (using same '/' or '\')

 

If you post the output I asked for, I will try to help. Without that, all I can say is ensure the system is properly expanding the variables and that the files exist at the location.

The GCC compiler and linker are not prone to bad behavior.

 

> repository_loc is set to C:\Users\Usuario\STM32Cube\Repository

> Path variable:-> REPOSITORY_LOC set as C:\Users\Dev\STM32Cube\Repository

So which one is it?

If you feel a post has answered your question, please click "Accept as Solution".

Is this easier to understand (there are no "=" signs of course):-

Resource/Linked Resources> REPOSITORY_LOC = C:\Users\Dev\STM32Cube\Repository

C++ Build/Settings/MCU GCC Compiler/Include paths> Line 2 = ${REPOSITORY_LOC}/STM32Cube_FW_H7_V1.11.1/Drivers/STM32H7xx_HAL_Driver/Inc

which causes include errors, but if I change it to:-

C:\Users\Dev\STM32Cube\Repository\STM32Cube_FW_H7_V1.11.1\Drivers\STM32H7xx_HAL_Driver\Inc

there are no errors but unless there is a syntax error in the include line ${REPOSITORY_LOC}/STM32Cube_FW_H7_V1.11.1/Drivers/STM32H7xx_HAL_Driver/Inc, then it should be the same.

all the include errors are related to CMSIS like the line below, but I did not change the CMSIS include line.

C:/Users/Dev/STM32Cube/Repository/STM32Cube_FW_H7_V1.11.1/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h:282:11: fatal error: stm32h7xx_hal.h: No such file or directory

282 | #include "stm32h7xx_hal.h"

| ^~~~~~~~~~~~~~~~~

 

 

Robmar
Senior III

I just found a similar bug report about link resources on Eclipse which sounds very similar:-

https://stackoverflow.com/questions/42816181/it-seems-not-possible-to-include-in-my-project-a-path-to-a-folder-that-has-bee 

I don't want to have to add every single include file from the Repository to my project to solve this!

I wonder of a solution is possible?

Pavel A.
Evangelist III

Yep this is nightmare!  Eclipse historically has two kinds of "path macros": one used in linked resources in .project files. This is common for all types of Eclipse projects. Another type are Build variables, these sit in .cproject files and are specific to CDT projects. Their syntax is a bit different, please note well how they are formatted when edited via Eclipse settings. The most confusing and gross is that the former variables do not work in most of CDT (include paths, source paths etc.) Again please edit these in the GUI settings first and note the usage, before tampering in .cproject files manually.  Always use the Unix form of slash (/). Eclipse will substitute before running commands.

But it is possible to make it work. We use these in most of our CubeIDE projects, they are portable between Linux and Windows, and are independent of user names.