So I’m having trouble getting even a simple Makefile to work. Heres what I have:
proj : driver.o
icc -g -O3 -openmp driver.o -o proj
driver.o : driver.c driver.h
icc -g -O3 -openmp driver.c
I feel like it’s pretty straight forward. Proj only depends on driver.o which in turn depends on driver.c and driver.h. When run, the compiler fails with ‘could not open source file “driver.h” ‘ at the include within the driver.c file. What am I missing?
Assuming you run
makefrom the directory where all source files and headers reside, make sure you use quotes in your include directive:…rather than:
The latter will search the system include path (and you will have to add the current directory to that path as larsmans suggested).