在MAC OS X 10.6上使用MySQL C API编译问题

时间:2023-01-29 20:46:44

i've a Problem with MySQL C API and Mac OS X 10.6. When i want to compile a SQL Client Program, it aborts with this Error Message

我对MySQL C API和Mac OS X 10.6有问题。当我想编译一个SQL客户端程序时,它会以这个错误消息终止

ld: library not found for -lmysqlclient

ld:未找到用于- mylsqlclient的库

collect2: ld returned 1 exit status

collect2: ld返回1退出状态

I compile with this command:

我用这个命令编译:

g++ -I /usr/local/mysql/include/ -L /usr/local/mysql/lib/ -lmysqlclient main.cpp

g++ -I /usr/local/mysql/include/ -L /usr/local/mysql/lib/ -lmysqlclient main.cpp。

I've tried the Headers and Librarys in different locations - no effect I've downloaded the headers and the Library from an other Destination - Same effect as before

我在不同的地方尝试过header和Librarys -没有效果,我从另一个目的地下载了header和Library -和以前一样

Any Ideas what i am doing wrong? If there is a thread allready i want to excuse (nothing found in search)!

你知道我做错了什么吗?如果有一个线程都准备好了,我想原谅(在搜索中没有发现)!

Greeting, Dennis

问候,丹尼斯

1 个解决方案

#1


4  

So after many days, of not intensive work ;-) here's the fault: the compiler doesn't accept the library if it is in the standard install directory. I copied the include and lib files into /usr/local/include and /usr/local/lib . Now it compiles without errors :-)

因此,经过许多天的不密集的工作;-)这是错误的:如果库在标准安装目录中,编译器不接受它。我将include和lib文件复制到/usr/local/include和/usr/local/lib中。现在它编译没有错误:-)

I don't know why it only works in the standard paths but however now it works.

我不知道为什么它只适用于标准路径,但现在它起作用了。

Dennis

丹尼斯

#1


4  

So after many days, of not intensive work ;-) here's the fault: the compiler doesn't accept the library if it is in the standard install directory. I copied the include and lib files into /usr/local/include and /usr/local/lib . Now it compiles without errors :-)

因此,经过许多天的不密集的工作;-)这是错误的:如果库在标准安装目录中,编译器不接受它。我将include和lib文件复制到/usr/local/include和/usr/local/lib中。现在它编译没有错误:-)

I don't know why it only works in the standard paths but however now it works.

我不知道为什么它只适用于标准路径,但现在它起作用了。

Dennis

丹尼斯