我有一个在这个版本的 Linux 上运行得很好的 make 文件。然而 为什么它不能在其他版本上运行...
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
codename : trusty
就在这里...它不能在这个上运行?为什么?
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
我在 xenial 上收到此错误...为什么?
Ubuntu mate $:make
gcc: error: missing filename after ‘-o’
gcc: fatal error: no input files
compilation terminated.
这是我的 make 文件(已更新,上一篇文章没有这个)
CFLAGS = gcc -g
OBJ = dummyDriverX1.o x1.o error.o
# Automatic substitution using suffix rules to
%.o: %.c
${CFLAGS} -c $<
%.o: %.cpp
${CFLAGS} -c $<
# Building x1 based on the required .o files
pell: ${OBJ}
${CFLAGS} -o pell ${OBJ}
clean:
rm ${OBJ}
最佳答案
你的 Makefile 用劣质的本土 cargo 崇拜猜测取代了 make 良好的内置默认规则。 Make 确切地知道如何使用适合您的编译器的正确标志和选项来编译 C 文件;不要试图智胜它,特别是如果您不熟悉编译器。 (因此,这本身并不是一个 make 问题;但是让 make 使用它的默认值将修复您不正确的编译器调用。)
关于linux - make在不同的linux下有不同的表现吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47358966/