C++ 常见报错

常见错误

一、so未找到

/usr/bin/ld: /home/haiqiao/adb_test/libmylib.so: undefined reference to `timer_settime'
/usr/bin/ld: /home/haiqiao/adb_test/libmylib.so: undefined reference to `timer_create'

编译参数增加

g++ -o build/exe build/test2.o -L/home/haiqiao/adb_test -L/usr/lib/x86_64-linux-gnu -lgtest -lpthread -lmylib -lcjson -lc -I/usr/include -lrt
# -lrt
# 对于so为librt.so

你可能感兴趣的:(c++)