undefined reference to symbol '_ZN5boost6system15system_categoryEv' error

寵の児 提交于 2021-02-17 20:35:19

问题


I'm new to c++ rest sdk Casablanca and using it in Codelite ide.
Operating System : Arch Linux
gcc version : 6.1.1
While building the code I get the following error in debug mode:

/bin/sh -c '/usr/bin/make -j4 -e -f  Makefile'
----------Building project:[ Casa - Debug ]----------
make[1]: Entering directory '/home/vinci/Documents/CPP_Projects_Programs/Casa'
/usr/bin/g++  -c  "/home/vinci/Documents/CPP_Projects_Programs/Casa/main.cpp" -g -O0 -fopenmp -std=c++14 -std=c++11 -Wall  -o ./Debug/main.cpp.o -I. -I/usr/local/include/cpprest -I/usr/local/include/pplx -I/home/vinci/casablanca/Release/src -I. -I/usr/local/include/cpprest -I/usr/local/include/pplx
/usr/bin/g++ -o ./Debug/Casa @"Casa.txt" -L. -L/usr/local/lib -L/usr/lib64 -L/usr/lib  -lcpprest
/usr/bin/ld: ./Debug/main.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/libboost_system.so.1.60.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Casa.mk:79: Debug/Casa] Error 1
make[1]: Leaving directory '/home/vinci/Documents/CPP_Projects_Programs/Casa'
make: *** [Makefile:5: All] Error 2
====1 errors, 0 warnings, total time: 00:00:14 seconds====

I searched this on Stackoverflow before asking and most of the answers just pointed to linking the libraries properly in project settings and I have done that as one can see in the code above but still keeps giving the error and I don't know what am i missing??

A little Help would be appreciated... Thank You


回答1:


/usr/lib/libboost_system.so.1.60.0: error adding symbols: DSO missing from command line

This DSO error means that libboost_system is missing from the command line. You should also add:

-lboost_system

to your command line just like -lcpprest




回答2:


This can happen if you reference libraries in the wrong order. I have a personal library that depends on -lboost_system, but I had listed my own library after the boost library and was getting this error. I moved my personal library to the front of the list, and the error went away.



来源:https://stackoverflow.com/questions/38650981/undefined-reference-to-symbol-zn5boost6system15system-categoryev-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!