cancel
Showing results for 
Search instead for 
Did you mean: 

files not being recognized if inside folder

tmehok
Associate III

I will attach my project below if you want the code for reference.

         I am making a HMI for construction workers for reference. Although my screen does everything I've needed thus far it has been hard to organize my code because I keep running into the error of "No such file or directory" when I begin to go from a large file into a more organized file. 

         Due to the nature of my project I do not know if the BSP.h file is generated for everyone. So I will try to be as general as possible. I want to take a function in a file found in Code/Inc/#organizedFileName# I want to include and run this function in a View.cpp file found in, TouchGFX/gui/src/#screenName#. When I leave the file in Code/Inc/#organizedFileName# I get the error "No such file or directory". When I take the file out into Code/Inc I do not get this error. My knowledge tells me it's a compilation path issue but I do not know how to fix that. For now I have been running most variable and function declaration through main.h(THIS IS NOT A GOAL OF MINE). Once I can fix this path issue I want to clean up my code. 

        Any advice and knowledge would be greatly appreciated. 

        Code in drop box https://www.dropbox.com/home 

3 REPLIES 3

Have you correctly set your Include Paths ?

tmehok
Associate III

I think I have set it correctly, I do #include "main.h" for example and that will work. For this specific file I called it #include bsp.h and that gave me an error only when it was in a level deeper than Core/Inc. If it is in Core/Inc/BSP it will not be recognized. I event did the whole path to make sure by doing #include <Core/Inc/BSP/bsp.h>. I attempted to substitute the < for a ", that did not work either. Does this have anything to do with whatever directory is supposed to be higher than Core?


@tmehok wrote:

 I called it #include bsp.h and that gave me an error only when it was in a level deeper than Core/Inc.


That means you need to add that folder (the one beneath Core/Inc) to your Include Paths.

The easiest way to do that is to right-click the folder in the IDE's Project Explorer, and choose 'Add/remove include path...'

You need to ensure that every folder which contains any header file(s) is included in your Include Paths:

https://community.st.com/t5/stm32-mcus/how-to-implement-a-usb-device-composite-in-stm32h5/ta-p/708078#:~:text=After%20doing%20that%2C%20we%20must%20configure%20the%20compiler%20to%20find%20all%20the%20include%20files.%20For%20that%2C%20right%2Dclick%20over%20all%20the%20folders%20called%20%E2%80%9CI...

 

Addendum:

This concept of "Include Paths" is common across (pretty much) all C IDEs - it's not specific to STM32CubeIDE or even Eclipse; eg, see:

https://devzone.nordicsemi.com/f/nordic-q-a/46716/simple-adc-code/184681

 

#IncludePaths #IncludePath