文章目录
sigsegv segmentation fault Segmentation fault
段错误就是指访问的内存超出了系统所给这个程序的内存空间
分析是否有针运算(加减)引起的越界、野指针、空指针都归为指针越界
//errot
BoundingBox *box; //野指针
CalBoundingBox(Points, box);
//right
BoundingBox *box = new BoundingBox(Point(0,0),Point(0,0));
CalBoundingBox(Points, box);
undefined reference to symbol ‘pthread_key_delete@@GLIBC_2.2.5’
## error undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
解决办法:在CmakeLists.txt文件中添加 pthread的编译选项
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")