cancel
Showing results for 
Search instead for 
Did you mean: 

Error including custom header files.

MVerm.2
Associate III

Hi

I am trying to include a custom Header file "LCD1602.h" along with its source file "LCD1602.c" in my project. I have also added the respective path in Project>Properties>C/C++ General>Paths and symbols. But when I build the project, the macros declared in the LCD1602.h seem to be unknown to the LCD160.c file. One of the error can be seen in the below image.

0693W000007E1TtQAK.bmp0693W000007E1XbQAK.bmpI am not able to figure out where the problem exactly lies.

Is there any issue with the hierarcy of folders? Cause I planned to follow the same structure for other components as well.

Also, I noticed that the icons of my custom .h and .c files are different from that of main.c and main.h

6 REPLIES 6
KnarfB
Principal III

An error analysis should start with the very first error. Is LCD1602.h included in LCD1602.c? Check also the console view output for resulting compiler options and try to understand what happened.

hth

KnarfB

Pavel A.
Evangelist III

There's something strange in the project explorer view on the top picture: what is the upper folder with name containing slashes?

0693W000007E2aWQAS.png 

Try to roll back your changes in the project and add the include path again, this time properly.

Use only the paths and symbols dialog, not drag and drop.

-- pa

The folder that you marked with a ? appeared automatically. I didn't create that. Is there any problem with the hierarchy I have chosen for the header and source files LCD1602 ? (ignoring that ? marked folder. I have deleted that)

The folder appears automatically whenever I Build the project.

I have also done: Project>Properties> C/C++ General> Paths and symbols>Include tab>Add, Checked the "Folder is a Workspace path", selected the Inc folder inside HubComponents folder. Still getting the below error. Further added the src folder in the Source folder tab.

0693W000007E9WCQA0.bmp0693W000007E9ViQAK.bmp

I forgot to include that in the source file. Thank you Sir.

Pavel A.
Evangelist III

Well, Eclipse can be hard to tame. But this should not bar you from making progress.

Move LCD1602.h to Src (same directory where LCD1602.c is) and continue working on the project.

Sort it down later.

-- pa

The project built successfully but I had to place the lcd .h and .c files in the same folders as main.h and main.c

This resolved the issue but still I was unable to place my custom .h and .c files in separate hierarchical directories.