简体   繁体   中英

Can't include a directory in my newbie Makefile

Simply I am trying to get ImageMagick headings into my newbie make scheme. Why is it still giving me 'no such file or directory' error?

CC=g++
CFLAGS=-c -I/usr/local/include/ImageMagick-7/ 

all: go

go: demo.o
    g++ demo.o -o test

demo.o: demo.cpp
    g++ -C demo.cpp

cleanup:
    rm *.o

You have declared the flags but you have not included the variable in the compile step. Change your makefile to this

CC=g++
CFLAGS=-c -I/usr/local/include/ImageMagick-7/ 

all: go

go: demo.o
    $(CC) demo.o -o test

demo.o: demo.cpp
    $(CC) $(CFLAGS) demo.cpp

cleanup:
    rm *.o
    rm test

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM