Undefined reference with -static?

别等时光非礼了梦想. 提交于 2019-12-12 04:17:05

问题


When I try to compile my program with CFLAGS = -static i receive an error undefined reference.

When compiling without static works perfectly.

My question is why the static error gives me undefined reference? I installed with pkg install mysql57-server And linked mysql_config --libs

Help ?


回答1:


When linking static libs, the order in which they come in command line matters (well, at least on FreeBSD). Try putting -lmysqlclient before/after all libraries.

And make sure there is /usr/local/lib/mysql/libmysqlclient.a too, of course.



来源:https://stackoverflow.com/questions/35767356/undefined-reference-with-static

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