Everytime I make a directory and code and make a file as such, it works. For some reason, this is not working. You can see my work in the terminal and you can see the file structure. For some reason I am able to make "caesar.h" which makes no sense (of course I get an error when running "./caesar.h"). This is not a duplicate question because I know for a fact I'm in the correct folder. This is also strictly in C.
make
may come with default rules for compiling certain files. It may compile .c
files or .cpp
files with different compilers for example.
.h
files are usually not compiled directly. They are #include
d by .c
files to become a part of the .c
file's translation unit. There is most probably no built-in rule in make
to compile your .h
file.
Rename caesar.h
into caesar.c
and then try make caesar
. My make
has a default rule for .c
files and compiles the program like so:
$ make caesar
cc caesar.c -o caesar
If that doesn't work, your make
may not have a default rule, so you could create a Makefile
in the caesar
directory:
% : %.c
$(CC) -o $@ $< -Og -Wall -Wextra -g -fsanitize=address,undefined
Note that the space before $(CC)
must be a single Tab character.