問(wèn)題描述
我在使用 MySQL C API 和 Mac OS X 10.6 時(shí)遇到問(wèn)題.當(dāng)我想編譯 SQL 客戶(hù)端程序時(shí),它會(huì)因此錯(cuò)誤消息而中止
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
ld: 找不到 -lmysqlclient 的庫(kù)
ld: library not found for -lmysqlclient
collect2:ld 返回 1 個(gè)退出狀態(tài)
collect2: ld returned 1 exit status
我用這個(gè)命令編譯:
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
我在不同位置嘗試了標(biāo)題和庫(kù) - 沒(méi)有效果我已經(jīng)從另一個(gè)目標(biāo)下載了標(biāo)題和庫(kù) - 效果與以前相同
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
任何想法我做錯(cuò)了什么?如果已經(jīng)有一個(gè)線程,我想原諒(在搜索中沒(méi)有找到)!
Any Ideas what i am doing wrong? If there is a thread allready i want to excuse (nothing found in search)!
你好,丹尼斯
推薦答案
所以經(jīng)過(guò)很多天的工作,不密集的工作 ;-) 這里是錯(cuò)誤:如果庫(kù)位于標(biāo)準(zhǔn)安裝目錄中,則編譯器不接受該庫(kù).我將包含和 lib 文件復(fù)制到 /usr/local/include
和 /usr/local/lib
.現(xiàn)在它編譯沒(méi)有錯(cuò)誤:-)
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 :-)
我不知道為什么它只能在標(biāo)準(zhǔn)路徑中工作,但現(xiàn)在它可以工作了.
I don't know why it only works in the standard paths but however now it works.
丹尼斯
這篇關(guān)于MAC OS X 10.6 上 MySQL C API 的編譯問(wèn)題的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!