macos 如何在 Mac OS X 上安装 MySQL Connector/C?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4615442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 07:33:32  来源:igfitidea点击:

How to install MySQL Connector/C on Mac OS X?

mysqlcmacos

提问by klaussner

I'm writing an app in C that requires MySQL interaction, so I downloaded the Connector/C archive from the official website, and it contains bin, lib and include folders, but I don't know where to install them. I could copy the include files into my project folder, but where can I put the lib file so that my compiled binary (and other binaries) can find it?

我正在用C写一个需要MySQL交互的应用,所以我从官网下载了Connector/C存档,里面有bin、lib和include文件夹,但是我不知道在哪里安装。我可以将包含文件复制到我的项目文件夹中,但是我可以将 lib 文件放在哪里,以便我编译的二进制文件(和其他二进制文件)可以找到它?

Thanks in advance!

提前致谢!

回答by Nektarios

This is confusing, isn't it.. don't know why they don't make this more clear.

这令人困惑,是不是......不知道他们为什么不把这个说得更清楚。

The lib/ files go in /usr/local/lib The include/ files go in /usr/local/include The bin/ files go in /usr/local/bin

lib/ 文件在 /usr/local/lib 中 include/ 文件在 /usr/local/include 中 bin/ 文件在 /usr/local/bin 中

The /usr/.. directory isn't visible through finder afaik so you have to go at it via commandline. Best of luck

/usr/.. 目录通过finder afaik 不可见,因此您必须通过命令行访问它。祝你好运

Also, in your Xcode project, make sure you add a Linked Library by going to your Target's settings, General, then adding Linked Library "libmysqlclient.dylib"

此外,在您的 Xcode 项目中,确保通过转到 Target 的设置,General,然后添加链接库“libmysqlclient.dylib”来添加链接库

回答by GreveX

Alternatively, to do everything on the commandline by "mv", you could also execute (on cmdline):

或者,要通过“mv”在命令行上执行所有操作,您还可以执行(在 cmdline 上):

defaults write com.apple.finder AppleShowAllFiles TRUE

and

killall Finder

to make the hidden folder /usr (and everything else) visible.

使隐藏文件夹 /usr(以及其他所有内容)可见。

After placing your connector files (like Nektarios explicitly discribed where) and closing all "hidden folder - finder windows", execute on your cmd:

放置连接器文件(如 Nektarios 明确描述的位置)并关闭所有“隐藏文件夹 - 查找器窗口”后,在您的 cmd 上执行:

defaults write com.apple.finder AppleShowAllFiles FALSE

and again

然后再次

killall Finder

to hide what have to be hidden.

隐藏必须隐藏的东西。