0
\$\begingroup\$

Here is the directory structure of a project I have downloaded: enter image description here

The problem is that when I compile I keep getting fatal error message that say that the specific header file does not exist. For example, right now there is #include "fatfs.h" inside the fatfs_disk_io.c.

The error message says "libfatfs/src/fatfs_diskio.c:46:19: fatal error: fatfs.h: No such file or directory"

As you can see, fatfs.h does exist but in another folder. If I use a relative path inside the #include directive inside fatfs_disk_io.c, then the program will compile. The issue is that there are a lot of references in different files to different headers. I can take my time and change them all to relative paths but please tell me, why in the world is Eclipse not able to just find the header files when they are inside the project directory? What do I need to do to make Eclipse realize that all the .h files being referenced are somewhere in the project folder so just find them.

\$\endgroup\$
  • \$\begingroup\$ Go to project settings and under C/C++ General settings find the "Paths and Symbols" setting. Off-topic by the way.... \$\endgroup\$ – Eugene Sh. Jul 9 '18 at 19:54
  • \$\begingroup\$ #include "../MyDir/MyFile.h ? \$\endgroup\$ – Tyler Jul 9 '18 at 19:58
  • \$\begingroup\$ You need to add something like ${ProjDirPath}\libfatfs\inc to your project's include directories search list. ..\inc might also work, but wouldn't technically be correct. \$\endgroup\$ – brhans Jul 9 '18 at 19:58
  • \$\begingroup\$ see, I have little experience with this tool, I just want to know the proper way to do this. For some reason the original author of this project did not use relative paths. I am not sure what the problem is. \$\endgroup\$ – quantum231 Jul 9 '18 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.