为什么我的生成文件没有生成对象文件?
Why is my makefile not generating object files?
这是我的制作文件:
LIBS = libxml2.so.2.9.4
LDFLAGS = -lstdc++ -lpthread -lxml2
vpath %.hpp ./
vpath %.cpp ./
vpath %.h ./libxml2/include/libxml
all: KeyGenerator
KeyGenerator: main.o ProjectXmlParser.o xmlparser.o
g++ ${CXXFLAGS} ${LDFLAGS} -o KeyGenerator $+ ${LIBS}
main.o: main.cpp
ProjectXmlParser.o: ProjectXmlParser.cpp ProjectXmlParser.hpp
xmlparser.o: xmlparser.cpp xmlparser.hpp global.hpp
phony: clean
clean:
rm -f *.o
输出:
/usr/bin/make -f Makefile CONF=Debug
g++ -g -Wall -std=gnu++11 -pthread -I./ -I./src -I./libxml2/include -lstdc++ -lpthread -lxml2 -o KeyGenerator main.o ProjectXmlParser.o xmlparser.o libxml2.so.2.9.4
g++: error: ProjectXmlParser.o: No such file or directory
g++: error: xmlparser.o: No such file or directory
Makefile:12: recipe for target 'KeyGenerator' failed
make: *** [KeyGenerator] Error 1
在项目目录中,我所有的hpp和cpp文件都存在于同一级别。我确实有一个名为libxml的附加项目正在使用。当我做一个构建时,会创建一个 main.o,但没有创建任何 .o 文件。我已经看到其他帖子提出了这个问题,但到目前为止,没有任何内容对我有用。
谢谢。
基于make -d
输出:
Must remake target 'ProjectXmlParser.o'.
Successfully remade target file 'ProjectXmlParser.o'.
似乎Make认为你有一个空的配方来建立这个目标。 也许在ProjectxXmlParser.o
和xmlparser.o
规则之后,您的生成文件中有一些杂散的 TAB 字符,这些字符未显示在您粘贴到此问题中的生成文件中?
相关文章:
- CMake-按正确顺序将项目与C运行时对象文件链接
- 如何在h文件中包含.o对象文件
- 如何使用单独文件中的派生类访问友元函数对象
- QML:修改在不同QML文件(而非main.QML)中定义的子对象的属性
- 使用逗号解析文件对象?
- 使用 CIN COUT 显示垃圾值的文件对象?
- 如何确保我的"ifstream"文件对象指向的文件内容已更新?
- 如何从 GDI+ 图元文件对象获取原始图元文件字节
- pyQt5 将文件对象传递给 QWebEngineView
- 从文件对象的当前位置删除字符
- 使用相同的文件对象按顺序写入和读取文件
- 将 ETW 文件对象与 DiskIO 事件相关联
- 如何在构建时将 JSON 文件/对象包含在C++中
- 如何使用运算符<<通过 << 将文件对象馈送到我的类?
- 确定两个文件路径引用同一文件对象的最佳方法是什么
- 文件映射对象和文件对象可以互换使用吗
- 如何判断给定点是否在STereoLithography(.stl)文件对象c++内
- 如何使用Windows Portable Devices C++API获取MTP设备公开的文件夹中的所有文件(对象)的列
- 如何使用结构传递文件对象
- 文件对象->文件名不返回文件的完整路径