cancel
Showing results for 
Search instead for 
Did you mean: 

Header files not being found even though the correct path is included in the project and resolved in the Project Explorer under Includes

PEmer.1
Associate II

Hi, I had added include paths for some header files, but they are not being found as shown in the image. I went to Properties > C/C++ General > Paths and Symbols > Includes to add the include paths. I confirmed that these paths exist in Properties > C/C++ Build > Settings > Tool Settings > MCU GCC Compiler > Include paths. Additionally the paths and header files seem to be resolved in the Project Explorer under Includes. The image specifically shows that qf_port.h is triggering a No file or directory error when included from qk_port.c even though qf_port.h is resolved under Includes. This is my first full project using STM32CubeIDE because I'm coming from TI MCUs and Code Composer Studio where I never had this kind of problem.

0693W000004Gs0SQAS.png

EDIT:

I've started looking through the makefiles and now understand why this error is occurring, but I'm not sure what to do about it.

Here is the structure of my debug folder

0693W000004GtQRQA0.png

Within Drivers\STM32F3xx_HAL_Driver\Src the subdir.mk file includes all of the paths I'd expect using the -I option as exemplified here

Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.o: ../Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c
	arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32F373xC -DDEBUG -c -I../Drivers/CMSIS/Include -I../Drivers/STM32F3xx_HAL_Driver/Inc -I../Drivers/STM32F3xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F3xx/Include -I../Core/Inc -I"C:/engineering/ep-pse-code/Core/Src" -I"C:/qp/qpc/include" -I"C:/qp/qpc/src" -I"C:/qp/qpc/ports/arm-cm/qk/gnu/" -Ofast -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.d" -MT"$@" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "$@"

Within Core\Src\qp_port the subdir.mk doesn't include the paths I'd expect and specifically doesn't include the C:\qp... folders mentioned earlier in the post. This specific line shows why I'm getting the error for qk_port.c because none of the qp include paths are included as -I options

Core/Src/qp_port/qk_port.o: ../Core/Src/qp_port/qk_port.c
	arm-none-eabi-gcc "$<" -mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32F373xC -DDEBUG -c -I../Drivers/CMSIS/Include -I../Drivers/STM32F3xx_HAL_Driver/Inc -I../Core/Inc -I../Drivers/STM32F3xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F3xx/Include -I"C:/engineering/ep-pse-code/Drivers/STM32F3xx_HAL_Driver/Src" -Ofast -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/qp_port/qk_port.d" -MT"$@" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "$@"

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

> and now understand why this error is occurring, but I'm not sure what to do about it.

It looks like Core/Src has tweaked settings (note the overlay icon on it). Maybe this is why the include paths do not propagate into it, Try to reset its settings to default.

-- pa

View solution in original post

5 REPLIES 5
TDK
Guru

Add the path to your include paths in the project properties. Reload the project. Clean/rebuild the project.

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

Thanks for your answer, but as mentioned and shown in my post, I added the include paths in the project properties. Clean and rebuild was done after every attempt to fix this problem. As shown, the subdir.mk files are not including the same files - do you know why this would be happening?

TDK
Guru

I assume the project is just stale. Did you refresh the project? Deleting the "Debug" or whatever build directory is active to force it to recreate everything will also work.

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

> and now understand why this error is occurring, but I'm not sure what to do about it.

It looks like Core/Src has tweaked settings (note the overlay icon on it). Maybe this is why the include paths do not propagate into it, Try to reset its settings to default.

-- pa

Pavel, thanks for the answer that helped me find a solution. I didn't notice that icon - here is a link I found that led me to my solution. The little icon means per file/folder build settings exist.

Right clicking properties and clicking "Restore Defaults" didn't solve the problem, but it did show me that I had per folder include paths. I didn't want to just change the per folder includes to match the project includes because I wanted the folder to inherit the project include paths and found that this did that: Right click Core/Src > Resource Configurations > Restore to default...