linux - 生成文件 g++ : fatal error: no input files

标签 linux g++ makefile

我现在正在上 C++ 类(class),为了努力拥抱 CS,我安装了 Linux Mint 15 (Olivia),并通过命令行和 vim 完成了我的作业和讲座。我们最近检查了 makefile,我遇到了 g++ 问题。我的 makefile 如下所示:

CXX = g++
CXXFLAGS += -pedantic-errors
CXXFLAGS += -g

OBJS = 

SRCS = constructors.cpp 

HEADERS = 

#target: dependencies
#   rule to build
#

constructors: ${OBJS} ${HEADERS}
    ${CXX} ${LDFLAGS} ${OBJS} -o constructors

${OBJS}: ${SRCS}
    ${CXX} ${CXXFLAGS} -c $(@:.o=.cpp)

当我运行时:

make constructors

我收到以下消息:

g++   -o constructors
g++: fatal error: no input files
compilation terminated.
make: *** [constructors] Error 4

我在同一个文件夹中有constructors.cpp,如果我手动编译它,它就可以完美工作。非常感谢任何建议。

最佳答案

OBJS = 

你...似乎在这里遗漏了一些东西。就像要构建一些对象一样。

关于linux - 生成文件 g++ : fatal error: no input files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18221855/

相关文章:

更改时区不根据时区更改日期格式

linux - Bash 脚本 : how to make two variables from a string?

linux - 如何在内核源代码中打印时间?

c++ - '/usr/include/c++/4.4/bits/'中的位是什么意思

c - Makefile 不清理目标文件

makefile - 在模式匹配函数中使用模式规则中 '%' 匹配的字符串

c - Makefile FFLAGS 描述

linux - 如何使用 linux 系统调用杀死生成的 "/bin/sh -c"及其所有子进程

c++ - g++ 对 ZMQ 的 undefined reference

c++ - 使用 g++ 编译 Makefile 时遇到问题