9

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?

Thanks in advance!

klaussner
  • 2,364
  • 3
  • 25
  • 33

2 Answers2

12

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

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

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"

Nektarios
  • 10,173
  • 8
  • 63
  • 93
  • 6
    You can hit Shift-Cmd-G in any Finder window to get to `/usr` – Dave DeLong Apr 14 '11 at 18:04
  • In Xcode after adding the Linked Library, I had to add `/usr/local/include` to the Header Search Paths. Right click on project and Get Info, select the build tab, then scroll down to find the Search Paths section. – Mark Aug 03 '11 at 13:49
  • 1
    Note you're [not supposed to put the files directly in `/usr/include/`](http://stackoverflow.com/questions/2892609/compile-problem-with-mysql-c-api-on-mac-os-x-10-6), which was a mistake I made. Always use `/usr/local/include` for your own files. – bobobobo Apr 10 '13 at 18:06
  • When adding to header search path make sure to set it as recursive – Cymric Jun 09 '15 at 15:48
3

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

defaults write com.apple.finder AppleShowAllFiles TRUE

and

killall Finder

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

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

defaults write com.apple.finder AppleShowAllFiles FALSE

and again

killall Finder

to hide what have to be hidden.

GreveX
  • 31
  • 1