This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi,
I have created Src/Driver/I2C folder in my project and created i2c_driver.c and i2c_driver.h files in that.
I have created Src/Test/I2C folder in my project and created test_i2c.c and test_i2c.h files in that.
To use the driver file i2c_driver.c, I would like to include i2c_driver.h in test_i2c.c.
One way to do that is, add #include "../../Driver/I2C/i2c_driver.h" in test_i2c.c
Another way I am trying is including the Src/Driver/I2C folder in the Include Options of the Compiler in the Project Properties and add #include "i2c_driver.h" in test_i2c.c directly. But the compiler is throwing an error saying "#1965 open source file "i2c_driver.h".
I would like to know why I am getting the error when I have already included the folder containing the driver header file.
Is there a better way to do it?
To sum up my problem, I am posting a screenshot of my project below:
I usually use a slightly different variable but what you have should work.
I have created a project with the same basic directory structure:
I then added the same include search path. Note that when you put your mouse over the ... it will display the full path so that you can check if it is correct.
Normally I use a variable more like this as that is the way it get inserted when I click the workspace button and select the folder under the project.
But it really shouldn't matter as if I add the same variable as you it works for me.
One thing I noticed in your screen capture is the little wrench icon on some of the folders such as Src. This means that the folder has file specific build options set. I am concerned that the include path is not being used when building the source file has you have overridden the build options for the files in that folder. If the include path was added to the project after that then it would not be used when building files that are under that folder.
There are a couple quick ways you can check that.
Regards,
John
Thanks a lot John for the cue.
The way you have suggested would really help me ease my problems.
Another thing I wanted to ask you was, is there a way where I use a makefile in every directory and subdirectory; where a makefile in a directory will compile all the files and sub-directories recursively using the subdirectory file. For e.g. there is a makefile in
For e.g. there is a makefile in I2C folder, which compiles i2c_driver.c and another makefile in SPI folder tp compile spi_driver.c. One directory up, Drivers folder will have a makefile which will collect the results from the makefiles of the respective sub-directories and compiles its own source files as well. And one directory up, likewise.
Is that feasible? Any illustration to do it?
Thanks and Regards,
Ankit