当前位置:网站首页>Darkent2ncnn error

Darkent2ncnn error

2022-06-26 00:10:00 Invincible Zhang Dadao

error

gcc obj/convert_verify.o libdarknet2ncnn.a -o convert_verify -L ncnn/build/install/lib/ -L . -L darknet -ldarknet -lncnn -ldarknet2ncnn -lm -pthread -fopenmp pkg-config --libs opencv -lstdc++ -I include -I ncnn/build/install/include/ -I darknet/include/ -I src -I ncnn/src/ pkg-config --cflags opencv -Wno-unused-result -Wfatal-errors -fPIC -Ofast

obj/convert_verify.o: In function `test_network(char*, char*, char*, char*, char*)’:

convert_verify.cpp:(.text+0x102): undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int)’

convert_verify.cpp:(.text+0x5c6): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)’

convert_verify.cpp:(.text+0x605): undefined reference to `cv::imshow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&)’

collect2: error: ld returned 1 exit status

Makefile:43: recipe for target ‘convert_verify’ failed

make: *** [convert_verify] Error 1

The error is as above .

reason

Because c++11 The problem of . As shown in red :

undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int)’

modify

g++ edition
[email protected]:~/zhouyi/darknet2ncnn-master# g++ -v

Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper

OFFLOAD_TARGET_NAMES=nvptx-none

OFFLOAD_TARGET_DEFAULT=1

Target: x86_64-linux-gnu

Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu 7.5.0-3ubuntu1~18.04’ --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

Thread model: posix

gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

Ubuntu edition
Ubuntu 18.04

resolvent
Force the use of c++11 Standard to compile . By modifying the Makefile To achieve . stay darknet2ncnn Of Makefile The first 23 That's ok , Increase the use of c++11 To compile the . As shown below :

LDFLAGS+= -std=c++11 pkg-config --libs opencv -lstdc++

Be careful c++11 Must be in lowercase .

preservation Makefile file , recompile . Problem solving .

原网站

版权声明
本文为[Invincible Zhang Dadao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206252129547339.html