Opencv 中对 cpp文件进行编译

mac2022-06-30  31

compiled a cpp source file in ubuntu.

In terminal:

$ gcc -o xxx xxx.cpp `pkg-config opencv --cflags --libs`

If compiled correctly, then generates a executable file: xxx In terminal enter the command:

./xxx

Bugs:

/usr/bin/ld: /tmp/ccOxdTSt.o: undefined reference to symbol '_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3' //usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

Gcc compiler encountered an err: error adding symbols: DSO missing from command line. Because the library is not found stdc++

Solution: use g++ instead of gcc Add -lstdc++ to the end of the gcc compile command

最新回复(0)