[英]Statically link MySQL in C++ Project (Mac OS X, g++, Eclipse)
I'm getting an error while trying to include libmysqlclient in a project. 尝试在项目中包含libmysqlclient时出现错误。 I'm using Mac OS X, Eclipse CDT, g++.
我正在使用Mac OS X,Eclipse CDT,g ++。
The error I'm getting is ld: library not found for -l/usr/local/mysql-5.6.15-osx10.7-x86_64/lib/libmysqlclient.a
, even though I included this file by navigating to it with the finder. 我得到的错误是
ld: library not found for -l/usr/local/mysql-5.6.15-osx10.7-x86_64/lib/libmysqlclient.a
,即使我通过使用发现者。
Can anyone help? 有人可以帮忙吗?
If the -l
linker flag is used, the correct value is -lmysqlclient
, which would find either libmysqliclient.a
or libmysqlclient.dylib
on the library search path. 如果使用
-l
链接器标志,则正确的值为-lmysqlclient
,它将在库搜索路径上找到libmysqliclient.a
或libmysqlclient.dylib
。
To solve your problem, do one of the following: 要解决您的问题,请执行以下任一操作:
Convince your IDE not to prepend -l
to the full pathname. 说服您的IDE不要在全路径名前加上
-l
。
In your IDE settings, add /usr/local/mysql-5.6.15-osx10.7-x86_64/lib
to the library search path (that's already done, as seen on the screen shots), and specify mysqlcient
in the Libraries section, so -lmysqlclient
would be passed to the linker. 在您的IDE设置中,将
/usr/local/mysql-5.6.15-osx10.7-x86_64/lib
添加到库搜索路径(如屏幕截图所示,已经完成),并在“ 库”部分中指定mysqlcient
,因此-lmysqlclient
将被传递给链接器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.