C++基礎 | 報錯
搞了一下午,終于找到答案了!!再Mac上使用自帶的g++編譯使用opencv編寫(xiě)的圖像代碼,在使用圖像數據結構時(shí),使用IplImage和CvMat數據類(lèi)型進(jìn)行簡(jiǎn)單的加載、顯示圖像和兩種數據的相互轉換都沒(méi)有錯誤,但只要使用Mat數據結構就出現下面的錯誤:
Undefined symbols for architecture x86_64:\
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:\
_main in main.o\
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:\
_main in main.o\
"std::terminate()", referenced from:\
___clang_call_terminate in main.o\
"___cxa_begin_catch", referenced from:\
___clang_call_terminate in main.o\
"___gxx_personality_v0", referenced from:\
_main in main.o\
Dwarf Exception Unwind Info (__eh_frame) in main.o\
ld: symbol(s) not found for architecture x86_64\
clang: error: linker command failed with exit code 1 (use -v to see invocation)\
make: *** [main] Error 1\
想了很多辦法,終于看到有人提示:編譯選項添加-lstdc++,即使用標準C++庫,問(wèn)題解決!
來(lái)源
https://blog.csdn.net/eric41050808/article/details/39502231