构建简要模块
Build brief module
我试图构建简短的软件。首先,我创建。/lib/libbrief。所以,其次,我试图建立主文件。.zip文件中包含的makefile:
CC=g++
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=main
//#Only enable -msse4.2 on CPUs supporting the POPCNT instruction
CFLAGS = -Wall -DNDEBUG -O3 -march=nocona #-msse4.2
//#CFLAGS = -Wall -DDEBUG -g -O0 -fno-inline-functions
LDFLAGS = -Wl
//# BRIEF
CFLAGS += -I../brief/include
LDFLAGS += -L../brief/lib -lbrief
//# OpenCV
CFLAGS += `pkg-config opencv --cflags`
LDFLAGS += `pkg-config opencv --libs`
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) -g -c $(CFLAGS) $< -o $@
clean:
rm -f $(OBJECTS) $(EXECUTABLE) matches.png
然而,我得到错误,与opencv相关。发现的错误:
g++ -Wl -L../brief/lib -lbrief `pkg-config opencv --libs` main.o -o main
main.o: In function `~BRIEF':
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:203:
undefined reference to `cvReleaseImage'
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:204:
undefined reference to `cvReleaseImage'
main.o: In function `BRIEF':
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:156:
undefined reference to `cvCreateImage'
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:157:
undefined reference to `cvCreateImage'
main.o: In function `TestSampler<signed char>::sampleGaussian(signed char*, int, int)'
main.o: In function `BRIEF':
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:156:
undefined reference to `cvCreateImage'
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:157:
undefined reference to `cvCreateImage'
main.o: In function `TestSampler<signed char>::sampleGaussian(signed char*, int, int)':
main.o: In function `BRIEF::writeTests(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&) const':
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:511:
undefined reference to `utils::stdoutError(std::basic_string<char,
std::char_traits<char>,
std::allocator<char> >, char const*, int, char const*)'
main.o: In function `BRIEF::readTests(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
Desktop/asdf/brief_v1.0/test_app/../brief/include/brief/BRIEF.hpp:524:
undefined reference to `utils::stdoutError(std::basic_string<char,
std::char_traits<char>,
std::allocator<char> >, char const*, int, char const*)'
main.o: In function `detectSURF':
Desktop/asdf/brief_v1.0/test_app/main.cpp:92: undefined reference to
`cvCreateMemStorage'
Desktop/asdf/brief_v1.0/test_app/main.cpp:101: undefined reference to
`cvExtractSURF'
Desktop/asdf/brief_v1.0/test_app/main.cpp:106: undefined reference to
`cvGetSeqElem'
main.o: In function `timeDescription(int)':
Desktop/asdf/brief_v1.0/test_app/main.cpp:201: undefined reference to
`cvLoadImage'
Desktop/asdf/brief_v1.0/test_app/main.cpp:214: undefined reference to
`cvReleaseImage'
main.o: In function `~BRIEF':
如何构建合适的main.cpp?
您必须在之前列出链接上的所有对象文件,例如它们使用的库。
参见,例如,为什么库的链接顺序有时会导致GCC中的错误?
相关文章:
- 从 pybind11 构建导入模块时出现"分段错误(核心转储)"
- 通过 cmake 从C++扩展构建 Python 子模块
- 使用 task_group 的英特尔线程构建模块性能不佳(新用户)
- 什么是运行英特尔线程构建模块的 XCode 8 环境变量
- Qt 模块(QtSerialPort)在Qt定制构建中找不到(针对ARM交叉编译)
- 无法在 Linux 上构建opencv_contrib模块
- 使用加密模块构建 Poco 1.9.0
- 交叉编译Qt模块(不构建完全全新构建)并添加到现有Qt中
- 如何导入或安装预构建的Python扩展模块(C )(即未通过Setuptools编译的库)
- 致命错误LNK1112:通过 vcvarsall .bat x86 运行构建'X86'模块计算机类型'x64'与目标计算机类型冲突
- Python 3.4.3 未能构建这些模块: _hashlib _ssl.
- Android系统模块不会在构建上产生输出
- 在Swift Project中使用OpENCV时,无法构建模块“ OpenCV2”
- 创建一个生成文件来构建切换的模块
- 使用自定义模块构建 python 解释器时出现问题
- 构建 tesseract3 训练模块时出现意外错误:"not declared in this scope"
- 未解析的外部符号构建 Python 模块
- boost是否需要特殊的python模块才能在linux中构建
- 如何配置Qt来构建所有模块
- 使用额外的模块构建opencv