- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I am feed up with having to add back about 15 lines of #includes of my personal functions in the form of #include statements to the bottom of the project.h file.
Most of the time everything is fine and the #includes are still there.
But the other times they disappear and cause errors.
I have saved all after adding the #include statement.
I have tried to place the #includes in the main.c file but they do not work as expected, I have found they only work in the project.h file.
I believe this mostly happens when I change the TopDesign.cysch design.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Reading this discussion, I wonder if you specified the include directories in the Build Settings?
One of the bad behavior of PSoC Creator is that even we include a header in the project, the project does not recognize the include directory for that file.
So we need to specify or add that include file in the Build Settings.
For example, one of my sample has relatively "many" files (headers and sources)
Re: MCU Tester, a Swiss Army Knife for PSoC (CY8CKIT-044 version)
And since I don't want to place too many files in the flat project folder,
I reorganized the folder structure like below
=======================
<project folder>/
codegentemp/
CortexM0/
Export/
Generated_Source/
sources/ <--- folder for additional sources and headers
TopDesign/
CLEAN.log
cyapicallbacks.h
func_list.c
func_list.h
main.c
...
<project>.cyprj
...
REBUILD.log
souces/
adc/
adc_utils.c
adc_utils.h
gpio/
gpio_utils.c
gpio_utils.h
i2c/
i2c_api_utils.c
i2c_api_utils.h
i2c_utils.c
i2c_utils.h
mem/
mem_utils.c
mem_utils.h
pwm/
pwm_utils.c
pwm_utils.h
spi/
spi_utils.c
spi_utils.h
tty/
tty_utils.c
tty_utils.h
=======================
Workspace Explorer shows
Note: I added "folders" manually and organized the files manually.
But this does not let PSoC Creator know where those headers are
even it recognizes where those sources files are....
So I needed to specify include directories by using "Build Settings"
I usually open it from right-click the project name -> Build Settings... like below,
but you can also invoke it from the menu Project > Build Settings...
In the Build Settings dialog, select <project> / ARM GCC... / Compiler
Then we can see "Additional Inlucde Directories" in the "General" section.
To modify (add/remove) directories, click the right side [...] button in the Additonal Include Directories
Then use [New] [Remove] [Down] [Up] buttons to add and prioritize your include directories
Hopefully, by doing this may improve your situation. (fingers crossed)
moto
P.S. I agree with Len-san about including a source file instead of a header.
Once I saw a user who had problems by including a source file.
I also recommend you to make it a header file or add a header file for that source file
and only include the header file.