2024-08-09 07:28 AM
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"
| ^~~~~~~~~~~~~~~~~
2024-08-09 07:35 AM
@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
2024-08-09 07:44 AM
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.
2024-08-09 08:33 AM
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?
2024-08-09 08:45 AM
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 '\')
2024-08-09 10:39 AM
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?
2024-08-09 11:04 AM
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"
| ^~~~~~~~~~~~~~~~~
2024-08-09 11:55 AM
I just found a similar bug report about link resources on Eclipse which sounds very similar:-
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?
2024-08-09 11:56 AM - edited 2024-08-09 12:00 PM
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.
2024-08-10 12:49 AM
You mean I have to hack the .cproject file and manually change the paths to fix this bug, to what exactly?
I'm trying to make the project portable to other PCs given the dumb use of the user directory on windows to store the ST Repository!