c++ - 无法在我的新手 Makefile 中包含目录

标签 c++ makefile

简单地说,我正在尝试将 ImageMagick 标题纳入我的新手制作方案。为什么它仍然给我“没有这样的文件或目录”错误?

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

最佳答案

你已经声明了标志,但你没有在编译步骤中包含变量。将您的 makefile 更改为此

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

关于c++ - 无法在我的新手 Makefile 中包含目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41372830/

相关文章:

c++ - boost Multi_Index 问题

c++ - 使用 setprecision 更新变量值

c++ - 从 C++ 的图像流中创建 Qml 视频

c++ - 在 QT-C++ 中制作 exe 文件缺少 qt5cored dll

c++ - SYSTEM_PROCESS_INFORMATION结构中的一些成员的含义是什么?

c++ - 数百个空闲线程的影响

java - 如何在 arm-v7 上编译 ftd2xxj?

c++ - 在 Ubuntu 上编写的 C++ 软件中的僵尸窗口

linux - 在 linux 内核构建期间删除不必要的驱动程序

makefile - 如果变量未设置,如何中止 makefile?