So this is my source tree for a simple note-taking app I’m creating.
Folder PATH listing for volume Seagate Ext
Volume serial number is 6C91-D326
E:.
ª .gitignore
ª README.md
ª
+---.vscode
ª c_cpp_properties.json
ª settings.json
ª
+---src
ª compile.sh
ª main.c
ª note-taker.config
ª
+---functions
ª create_note.c
ª delete_note.c
ª view_note.c
ª
+---includes
foo.c
foo.h
func.h
Whenever I run gcc main.c includes/foo.c functions/create_note.c functions/view_note.c functions/delete_note.c -o x
I’m getting:
functions/create_note.c:7:10: fatal error: includes/foo.h: No such file or directory
#include "includes/foo.h"
^~~~~~~~~~~~~~~~
compilation terminated.
functions/view_note.c:3:10: fatal error: includes/func.h: No such file or directory
#include "includes/func.h"
^~~~~~~~~~~~~~~~~
compilation terminated.
functions/delete_note.c:3:10: fatal error: includes/func.h: No such file or directory
#include "includes/func.h"
^~~~~~~~~~~~~~~~~
compilation terminated.
Inside my create_note.c
this is how I’ve ordered the preprocessors.
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "includes/foo.h"
#include "includes/func.h"
func.h
has three functions declared which are all inside functions/
, and create_note.c
is one of them. The above shows how the preprocessors are inside create_note.c
as mentioned. How would I solve the compile error?
I’ve tried doing this in my #include
:
#include "srcincludefoo.h"
#include "./includes/foo.h
Expectation is: the program should compile successfully and work!
New contributor