Closed wangzhankun closed 5 years ago
你没加相关includes路径,请看下相关文档:https://xmake.io/#/zh-cn/manual/project_target?id=targetadd_includedirs
pthread这种系统库,直接可以通过add_syslinks来加就行了,可以看下文档:https://xmake.io/#/zh-cn/manual/project_target?id=targetadd_syslinks
其他第三方库的查找,可以使用你刚设置的方式,也可以通过find_packages来一次查找多个:
on_load(function (target)
target:add(find_packages("xxx", "bbb"))
end)
你也可以手动执行 xmake l find_packages xxx
,如果没找到,就是系统没安装相关库,或者库名不对。
关于find_packages的详细使用描述,可以看下文档:https://xmake.io/#/zh-cn/package/system_package?id=查找系统包 (文档我刚更新过了)
你也可以使用add_requires来直接集成依赖库,具体看下文档:https://xmake.io/#/zh-cn/package/remote_package
你没加相关includes路径,请看下相关文档:https://xmake.io/#/zh-cn/manual/project_target?id=targetadd_includedirs
pthread这种系统库,直接可以通过add_syslinks来加就行了,可以看下文档:https://xmake.io/#/zh-cn/manual/project_target?id=targetadd_syslinks
其他第三方库的查找,可以使用你刚设置的方式,也可以通过find_packages来一次查找多个:
on_load(function (target) target:add(find_packages("xxx", "bbb")) end)
你也可以手动执行
xmake l find_packages xxx
,如果没找到,就是系统没安装相关库,或者库名不对。关于find_packages的详细使用描述,可以看下文档:https://xmake.io/#/zh-cn/package/system_package?id=查找系统包 (文档我刚更新过了)
你也可以使用add_requires来直接集成依赖库,具体看下文档:https://xmake.io/#/zh-cn/package/remote_package
非常感谢你的回复。现在可以编译了。但是在链接时不知道为啥无法link OpenCV。但是xmake可以找到OpenCV。 部分报错如下:
[100%]: linking.release myrm
error: build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `AngleCalculate::pnpSolver(cv::RotatedRect&, cv::RotatedRect&, TargetData&)':
AngleCalculate.cpp:(.text+0x74e): undefined reference to `cv::Mat::zeros(int, int, int)'
AngleCalculate.cpp:(.text+0x794): undefined reference to `cv::Mat::zeros(int, int, int)'
AngleCalculate.cpp:(.text+0x8d0): undefined reference to `cv::solvePnP(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, bool, int)'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::String::String(char const*)':
AngleCalculate.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x54): undefined reference to `cv::String::allocate(unsigned long)'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::String::~String()':
AngleCalculate.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::Mat::~Mat()':
AngleCalculate.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::Mat::operator=(cv::Mat const&)':
AngleCalculate.cpp:(.text._ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0x11b): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::Mat::create(int, int, int)':
AngleCalculate.cpp:(.text._ZN2cv3Mat6createEiii[_ZN2cv3Mat6createEiii]+0x9d): undefined reference to `cv::Mat::create(int, int const*, int)'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::Mat::release()':
AngleCalculate.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x4b): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::Mat::operator=(cv::Mat&&)':
AngleCalculate.cpp:(.text._ZN2cv3MataSEOS0_[_ZN2cv3MataSEOS0_]+0xe7): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/release/src/AngleCalculate.cpp.o: In function `cv::MatConstIterator::MatConstIterator(cv::Mat const*)':
AngleCalculate.cpp:(.text._ZN2cv16MatConstIteratorC2EPKNS_3MatE[_ZN2cv16MatConstIteratorC5EPKNS_3MatE]+0xe9): undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
你可以找下错误提示中 cv::Mat cv::String 这些符号所在的库,是哪个,是否在find_packages的links里,如果在,确认下链接的依赖顺序是否正确。
你可以找下错误提示中 cv::Mat cv::String 这些符号所在的库,是哪个,是否在find_packages的links里,如果在,确认下链接的依赖顺序是否正确。 非常感谢,问题解决了,确实是链接顺序的问题。请问在哪里我可以找到有关链接顺序问题的说明呢。我应该如何配置呢?我是把配置更改如下才编译成功的:
add_syslinks("pthread", "gxiapi") target("myrm") set_kind("binary") set_optimize("fastest") add_includedirs("include") add_files("src/*.cpp") on_load(function (target) import("lib.detect.find_package") target:add(find_package("opencv")) end)
add_links/add_syslinks 内部根据添加顺序作为依赖顺序
add_syslinks 作为系统库,链接顺序在 所有 add_links之后
find_packages里面默认跟add_links的行为一致,就看哪个先添加了
on_load(function (target)
target:add("syslinks", "pthread")
target:add("links", "xxx", "zzz")
target:add(find_packages("yyy"))
end)
根据添加顺序来作为links顺序, -lxxx -lzzz -lyyy -lpthread
add_links/add_syslinks 内部根据添加顺序作为依赖顺序
add_syslinks 作为系统库,链接顺序在 所有 add_links之后
find_packages里面默认跟add_links的行为一致,就看哪个先添加了
on_load(function (target) target:add("syslinks", "pthread") target:add("links", "xxx", "zzz") target:add(find_packages("yyy")) end)
根据添加顺序来作为links顺序, -lxxx -lzzz -lyyy -lpthread
请问为啥相同的配置,release能正常编译链接生成,debug模式又出现了无法链接OpenCV的情况呢?有关release和debug模式的切换是通过xmake的vscode插件完成的。 更改了配置可以正常编译,release和debug都可以。不知道为啥。 正确配置:
add_syslinks("pthread", "gxiapi")
add_requires("opencv")
target("myrm")
set_kind("binary")
set_optimize("fastest")
add_includedirs("include")
add_files("src/*.cpp")
-- on_load(function (target)
-- import("lib.detect.find_package")
-- target:add(find_package("opencv"))
-- end)
add_packages("opencv")
报错配置如下:
add_syslinks("pthread", "gxiapi")
target("myrm")
set_kind("binary")
set_optimize("fastest")
add_includedirs("include")
add_files("src/*.cpp")
on_load(function (target)
import("lib.detect.find_package")
target:add(find_package("opencv"))
end)
报错如下:
[100%]: linking.debug myrm
error: build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o: In function `AngleCalculate::pnpSolver(cv::RotatedRect&, cv::RotatedRect&, TargetData&)':
AngleCalculate.cpp:(.text+0x689): undefined reference to `cv::Mat::zeros(int, int, int)'
AngleCalculate.cpp:(.text+0x784): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0x804): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0x882): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0x899): undefined reference to `cv::Mat::zeros(int, int, int)'
AngleCalculate.cpp:(.text+0x994): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0xa14): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0xa92): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0xb85): undefined reference to `cv::solvePnP(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, bool, int)'
AngleCalculate.cpp:(.text+0xda7): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0xe1f): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text+0x1054): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text+0x1065): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text+0x1075): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text+0x1088): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text+0x109c): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o:AngleCalculate.cpp:(.text+0x10ad): more undefined references to `cv::Mat::deallocate()' follow
build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o: In function `cv::Mat_<float>::~Mat_()':
AngleCalculate.cpp:(.text._ZN2cv4Mat_IfED2Ev[_ZN2cv4Mat_IfED5Ev]+0x72): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o: In function `cv::Mat::~Mat()':
AngleCalculate.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x89): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x72): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o: In function `cv::MatConstIterator::operator++()':
AngleCalculate.cpp:(.text._ZN2cv16MatConstIteratorppEv[_ZN2cv16MatConstIteratorppEv]+0x38): undefined reference to `cv::MatConstIterator::seek(long, bool)'
build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o: In function `cv::MatExpr::~MatExpr()':
AngleCalculate.cpp:(.text._ZN2cv7MatExprD2Ev[_ZN2cv7MatExprD5Ev]+0x9a): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text._ZN2cv7MatExprD2Ev[_ZN2cv7MatExprD5Ev]+0x127): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text._ZN2cv7MatExprD2Ev[_ZN2cv7MatExprD5Ev]+0x1ad): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text._ZN2cv7MatExprD2Ev[_ZN2cv7MatExprD5Ev]+0x1c0): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text._ZN2cv7MatExprD2Ev[_ZN2cv7MatExprD5Ev]+0x1d5): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text._ZN2cv7MatExprD2Ev[_ZN2cv7MatExprD5Ev]+0x19a): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/debug/src/AngleCalculate.cpp.o: In function `_GLOBAL__sub_I_intrinsic_matrix_8_640':
AngleCalculate.cpp:(.text.startup+0xc9): undefined reference to `cv::Mat::create(int, int const*, int)'
AngleCalculate.cpp:(.text.startup+0x169): undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
AngleCalculate.cpp:(.text.startup+0x33a): undefined reference to `cv::String::allocate(unsigned long)'
AngleCalculate.cpp:(.text.startup+0x36c): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
AngleCalculate.cpp:(.text.startup+0x374): undefined reference to `cv::String::deallocate()'
AngleCalculate.cpp:(.text.startup+0x3a8): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
AngleCalculate.cpp:(.text.startup+0x8d3): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
AngleCalculate.cpp:(.text.startup+0x91e): undefined reference to `cv::Mat::reshape(int, int, int const*) const'
AngleCalculate.cpp:(.text.startup+0x977): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
AngleCalculate.cpp:(.text.startup+0xa01): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text.startup+0xa6c): undefined reference to `cv::Mat::reshape(int, int, int const*) const'
AngleCalculate.cpp:(.text.startup+0xaf0): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text.startup+0xb75): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text.startup+0xbc1): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text.startup+0xc4a): undefined reference to `cv::fastFree(void*)'
AngleCalculate.cpp:(.text.startup+0xcc7): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text.startup+0xd6e): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text.startup+0xd7f): undefined reference to `cv::Mat::deallocate()'
AngleCalculate.cpp:(.text.startup+0xdc9): undefined reference to `cv::String::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/actions.cpp.o: In function `showPicture(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, cv::Mat const&, double)':
actions.cpp:(.text+0x5e): undefined reference to `cv::String::allocate(unsigned long)'
actions.cpp:(.text+0x79): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
actions.cpp:(.text+0x81): undefined reference to `cv::String::deallocate()'
actions.cpp:(.text+0x98): undefined reference to `cv::waitKey(int)'
actions.cpp:(.text+0xc1): undefined reference to `cv::String::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/main.cpp.o: In function `std::queue<cv::Mat, std::deque<cv::Mat, std::allocator<cv::Mat> > >::~queue()':
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0xda): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x1c2): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x204): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x2d2): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x34c): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x359): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x412): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED2Ev[_ZNSt5queueIN2cv3MatESt5dequeIS1_SaIS1_EEED5Ev]+0x453): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/PictureManipulator.cpp.o: In function `PictureManipulator::PictureManipulator()':
PictureManipulator.cpp:(.text+0x223): undefined reference to `cv::VideoWriter::VideoWriter()'
PictureManipulator.cpp:(.text+0x234): undefined reference to `cv::VideoWriter::VideoWriter()'
PictureManipulator.cpp:(.text+0x38d): undefined reference to `cv::VideoWriter::~VideoWriter()'
PictureManipulator.cpp:(.text+0x396): undefined reference to `cv::VideoWriter::~VideoWriter()'
build/.objs/myrm/linux/x86_64/debug/src/PictureManipulator.cpp.o: In function `PictureManipulator::~PictureManipulator()':
PictureManipulator.cpp:(.text+0x4b2): undefined reference to `cv::fastFree(void*)'
PictureManipulator.cpp:(.text+0x54a): undefined reference to `cv::fastFree(void*)'
PictureManipulator.cpp:(.text+0x6b9): undefined reference to `cv::VideoWriter::~VideoWriter()'
PictureManipulator.cpp:(.text+0x6c6): undefined reference to `cv::VideoWriter::~VideoWriter()'
PictureManipulator.cpp:(.text+0x6f0): undefined reference to `cv::Mat::deallocate()'
PictureManipulator.cpp:(.text+0x708): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/PictureManipulator.cpp.o: In function `PictureManipulator::PictureManipulator(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, int, int)':
PictureManipulator.cpp:(.text+0x7cd): undefined reference to `cv::VideoWriter::VideoWriter()'
PictureManipulator.cpp:(.text+0x7de): undefined reference to `cv::VideoWriter::VideoWriter()'
PictureManipulator.cpp:(.text+0xaef): undefined reference to `cv::VideoWriter::open(cv::String const&, int, double, cv::Size_<int>, bool)'
PictureManipulator.cpp:(.text+0xaf7): undefined reference to `cv::String::deallocate()'
PictureManipulator.cpp:(.text+0xbdb): undefined reference to `cv::VideoWriter::open(cv::String const&, int, double, cv::Size_<int>, bool)'
PictureManipulator.cpp:(.text+0xbe7): undefined reference to `cv::String::deallocate()'
PictureManipulator.cpp:(.text+0xc39): undefined reference to `cv::String::allocate(unsigned long)'
PictureManipulator.cpp:(.text+0xc5c): undefined reference to `cv::String::allocate(unsigned long)'
PictureManipulator.cpp:(.text+0xeab): undefined reference to `cv::VideoWriter::~VideoWriter()'
PictureManipulator.cpp:(.text+0xeb5): undefined reference to `cv::VideoWriter::~VideoWriter()'
PictureManipulator.cpp:(.text+0xfb8): undefined reference to `cv::String::deallocate()'
PictureManipulator.cpp:(.text+0xfe7): undefined reference to `cv::String::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/PictureManipulator.cpp.o: In function `ArmorDetector::~ArmorDetector()':
PictureManipulator.cpp:(.text._ZN13ArmorDetectorD2Ev[_ZN13ArmorDetectorD5Ev]+0x9a): undefined reference to `cv::fastFree(void*)'
PictureManipulator.cpp:(.text._ZN13ArmorDetectorD2Ev[_ZN13ArmorDetectorD5Ev]+0x132): undefined reference to `cv::fastFree(void*)'
PictureManipulator.cpp:(.text._ZN13ArmorDetectorD2Ev[_ZN13ArmorDetectorD5Ev]+0x210): undefined reference to `cv::Mat::deallocate()'
PictureManipulator.cpp:(.text._ZN13ArmorDetectorD2Ev[_ZN13ArmorDetectorD5Ev]+0x228): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/Camera.cpp.o: In function `Camera::~Camera()':
Camera.cpp:(.text+0x1ad): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/Camera.cpp.o: In function `Camera::configFrame(long, long, int, int, double, long)':
Camera.cpp:(.text+0xfc8): undefined reference to `cv::Mat::create(int, int const*, int)'
Camera.cpp:(.text+0x10a0): undefined reference to `cv::Mat::create(int, int const*, int)'
build/.objs/myrm/linux/x86_64/debug/src/Camera.cpp.o: In function `Camera::getFrame()':
Camera.cpp:(.text+0x15b0): undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
build/.objs/myrm/linux/x86_64/debug/src/Camera.cpp.o: In function `Camera::~Camera()':
Camera.cpp:(.text+0x198): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/debug/src/RMVideoCapture.cpp.o: In function `RMVideoCapture::cvtRaw2Mat(void const*, cv::Mat&)':
RMVideoCapture.cpp:(.text+0x1c6): undefined reference to `cv::Mat::updateContinuityFlag()'
RMVideoCapture.cpp:(.text+0x1ec): undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
RMVideoCapture.cpp:(.text+0x29b): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0x308): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0x382): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0x454): undefined reference to `cv::Mat::updateContinuityFlag()'
RMVideoCapture.cpp:(.text+0x494): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
RMVideoCapture.cpp:(.text+0x51d): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0x54c): undefined reference to `cv::Mat::deallocate()'
RMVideoCapture.cpp:(.text+0x55c): undefined reference to `cv::Mat::deallocate()'
RMVideoCapture.cpp:(.text+0x56c): undefined reference to `cv::Mat::deallocate()'
RMVideoCapture.cpp:(.text+0x598): undefined reference to `cv::String::allocate(unsigned long)'
RMVideoCapture.cpp:(.text+0x5d9): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
RMVideoCapture.cpp:(.text+0x5e1): undefined reference to `cv::String::deallocate()'
RMVideoCapture.cpp:(.text+0x628): undefined reference to `cv::String::allocate(unsigned long)'
RMVideoCapture.cpp:(.text+0x669): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
RMVideoCapture.cpp:(.text+0x671): undefined reference to `cv::String::deallocate()'
RMVideoCapture.cpp:(.text+0x6cc): undefined reference to `cv::String::deallocate()'
RMVideoCapture.cpp:(.text+0x6ec): undefined reference to `cv::String::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/RMVideoCapture.cpp.o: In function `RMVideoCapture::operator>>(cv::Mat&)':
RMVideoCapture.cpp:(.text+0x8fb): undefined reference to `cv::Mat::updateContinuityFlag()'
RMVideoCapture.cpp:(.text+0x921): undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
RMVideoCapture.cpp:(.text+0x9d4): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0xa41): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0xac1): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0xb96): undefined reference to `cv::Mat::updateContinuityFlag()'
RMVideoCapture.cpp:(.text+0xbd6): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
RMVideoCapture.cpp:(.text+0xc5d): undefined reference to `cv::fastFree(void*)'
RMVideoCapture.cpp:(.text+0xc8c): undefined reference to `cv::Mat::deallocate()'
RMVideoCapture.cpp:(.text+0xc9c): undefined reference to `cv::Mat::deallocate()'
RMVideoCapture.cpp:(.text+0xcac): undefined reference to `cv::Mat::deallocate()'
RMVideoCapture.cpp:(.text+0xcd8): undefined reference to `cv::String::allocate(unsigned long)'
RMVideoCapture.cpp:(.text+0xd19): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
RMVideoCapture.cpp:(.text+0xd21): undefined reference to `cv::String::deallocate()'
RMVideoCapture.cpp:(.text+0xd70): undefined reference to `cv::String::allocate(unsigned long)'
RMVideoCapture.cpp:(.text+0xdb1): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
RMVideoCapture.cpp:(.text+0xdb9): undefined reference to `cv::String::deallocate()'
RMVideoCapture.cpp:(.text+0xe04): undefined reference to `cv::String::deallocate()'
RMVideoCapture.cpp:(.text+0xe4a): undefined reference to `cv::String::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/for_main.cpp.o: In function `getImageFromCamera(void*)':
for_main.cpp:(.text+0x1af): undefined reference to `cv::fastFree(void*)'
for_main.cpp:(.text+0x230): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/for_main.cpp.o: In function `mainpulatePicture(PictureManipulator*)':
for_main.cpp:(.text+0x763): undefined reference to `cv::fastFree(void*)'
for_main.cpp:(.text+0x89a): undefined reference to `cv::fastFree(void*)'
for_main.cpp:(.text+0x8ec): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
for_main.cpp:(.text+0x96a): undefined reference to `cv::fastFree(void*)'
for_main.cpp:(.text+0x9bc): undefined reference to `cv::Mat::deallocate()'
for_main.cpp:(.text+0x9cc): undefined reference to `cv::Mat::deallocate()'
for_main.cpp:(.text+0x9d9): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `ArmorDetector::whiteSums(cv::Mat&)':
ArmorDetector.cpp:(.text+0x7e9): undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
ArmorDetector.cpp:(.text+0x85e): undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
ArmorDetector.cpp:(.text+0x90b): undefined reference to `cv::MatConstIterator::seek(long, bool)'
ArmorDetector.cpp:(.text+0xf06): undefined reference to `cv::MatConstIterator::seek(long, bool)'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `ArmorDetector::drawRRects(cv::Mat&, std::vector<cv::RotatedRect, std::allocator<cv::RotatedRect> >)':
ArmorDetector.cpp:(.text+0x1007): undefined reference to `cv::RotatedRect::points(cv::Point_<float>*) const'
ArmorDetector.cpp:(.text+0x1083): undefined reference to `cv::line(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `ArmorDetector::colorThres(cv::Mat&)':
ArmorDetector.cpp:(.text+0x1209): undefined reference to `cv::getStructuringElement(int, cv::Size_<int>, cv::Point_<int>)'
ArmorDetector.cpp:(.text+0x123f): undefined reference to `cv::getStructuringElement(int, cv::Size_<int>, cv::Point_<int>)'
ArmorDetector.cpp:(.text+0x1297): undefined reference to `cv::split(cv::_InputArray const&, cv::_OutputArray const&)'
ArmorDetector.cpp:(.text+0x12e1): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
ArmorDetector.cpp:(.text+0x1336): undefined reference to `cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)'
ArmorDetector.cpp:(.text+0x133b): undefined reference to `cv::noArray()'
ArmorDetector.cpp:(.text+0x13c6): undefined reference to `cv::subtract(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, int)'
ArmorDetector.cpp:(.text+0x141b): undefined reference to `cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)'
ArmorDetector.cpp:(.text+0x14d7): undefined reference to `cv::dilate(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Point_<int>, int, int, cv::Scalar_<double> const&)'
ArmorDetector.cpp:(.text+0x1572): undefined reference to `cv::dilate(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Point_<int>, int, int, cv::Scalar_<double> const&)'
ArmorDetector.cpp:(.text+0x1588): undefined reference to `cv::operator&(cv::Mat const&, cv::Mat const&)'
ArmorDetector.cpp:(.text+0x1632): undefined reference to `cv::fastFree(void*)'
ArmorDetector.cpp:(.text+0x16c2): undefined reference to `cv::fastFree(void*)'
ArmorDetector.cpp:(.text+0x174e): undefined reference to `cv::fastFree(void*)'
ArmorDetector.cpp:(.text+0x17de): undefined reference to `cv::fastFree(void*)'
ArmorDetector.cpp:(.text+0x1875): undefined reference to `cv::fastFree(void*)'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o:ArmorDetector.cpp:(.text+0x1905): more undefined references to `cv::fastFree(void*)' follow
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `ArmorDetector::colorThres(cv::Mat&)':
ArmorDetector.cpp:(.text+0x1aa4): undefined reference to `cv::Mat::deallocate()'
ArmorDetector.cpp:(.text+0x1ab1): undefined reference to `cv::Mat::deallocate()'
ArmorDetector.cpp:(.text+0x1ac3): undefined reference to `cv::Mat::deallocate()'
ArmorDetector.cpp:(.text+0x1ad2): undefined reference to `cv::Mat::deallocate()'
ArmorDetector.cpp:(.text+0x1ae1): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o:ArmorDetector.cpp:(.text+0x1aee): more undefined references to `cv::Mat::deallocate()' follow
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `ArmorDetector::getContours()':
ArmorDetector.cpp:(.text+0x1c96): undefined reference to `cv::findContours(cv::_InputOutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `ArmorDetector::getCenters(cv::Mat&, TargetData&)':
ArmorDetector.cpp:(.text+0x30f7): undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
ArmorDetector.cpp:(.text+0x31e0): undefined reference to `cv::fitEllipse(cv::_InputArray const&)'
ArmorDetector.cpp:(.text+0x3233): undefined reference to `cv::ellipse(cv::_InputOutputArray const&, cv::RotatedRect const&, cv::Scalar_<double> const&, int, int)'
ArmorDetector.cpp:(.text+0x32e7): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
ArmorDetector.cpp:(.text+0x3734): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/ArmorDetector.cpp.o: In function `std::vector<cv::Mat, std::allocator<cv::Mat> >::~vector()':
ArmorDetector.cpp:(.text._ZNSt6vectorIN2cv3MatESaIS1_EED2Ev[_ZNSt6vectorIN2cv3MatESaIS1_EED5Ev]+0xc1): undefined reference to `cv::fastFree(void*)'
ArmorDetector.cpp:(.text._ZNSt6vectorIN2cv3MatESaIS1_EED2Ev[_ZNSt6vectorIN2cv3MatESaIS1_EED5Ev]+0x10c): undefined reference to `cv::Mat::deallocate()'
build/.objs/myrm/linux/x86_64/debug/src/SentryPictureManipulator.cpp.o: In function `SentryPictureManipulator::manipulatePicture(cv::Mat)':
SentryPictureManipulator.cpp:(.text+0x524): undefined reference to `cv::VideoWriter::operator<<(cv::Mat const&)'
SentryPictureManipulator.cpp:(.text+0x546): undefined reference to `cv::VideoWriter::operator<<(cv::Mat const&)'
SentryPictureManipulator.cpp:(.text+0x6e3): undefined reference to `cv::fastFree(void*)'
SentryPictureManipulator.cpp:(.text+0x76c): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
SentryPictureManipulator.cpp:(.text+0x77c): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
debug/release只跟xmake.lua里面add_rules("mode.debug", "mode.release")
的设置有关,只影响编译优化选项,如果xmake.lua没有加这个设置,是否切到debug/release效果都是一样的。。
你可以自己敲 -v 编译,获取完整编译,链接参数,作对比分析,理论上不会影响链接顺序,如果有符号链接不到,通过-v编译链接,查看完整link命令,对比分析下实际的link顺序是否ok
描述问题
第一次使用xmake,同时对工程项目本身不太了解。该工程通过cmake编译无误。但是使用xmake编译自己的工程时,出现了下面的问题: 下面是我的配置
下图是我的目录树: 请问是哪里出错了呢? 我看给出的例子里面也没有include相关的头文件的信息。另一方面,不知道我的第三方库引入是否正确。 谢谢。