编译报错:
./build5.sh
/opt/poky/1.7/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: /tmp/ccoWZZeL.o: undefined reference to symbol '_Znwj@@GLIBCXX_3.4'
/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
fatal error: iostream: No such file or directory
#include <iostream>
遇到这样的错误,特别容易犯迷糊,说说解决方法:
方法一:
如果你用的是gcc 那么可以换成g++
方法二:
就是我遇到的这种情况
把 $CC 换成 $CXX 就可以编译通过了
source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi #添加自己使用的交叉编译工具链
$CXX -o rsu_client.out rsu_client_final.cpp -lpthread -Wall -std=c++11 -L ../../../CW_CoreData_Pub/output -lcw_coredata -L ../../output -lcw_shared_lib -I"../../inc"
#cp testsdk ../../output
cp rsu_client.out ../../output