2013-10-29 46 views
-2

我試圖編譯使用MYSQL庫的程序。 這些都是我的,包括:編譯MYSQL程序時出錯「未定義引用」

#include <stdio.h> 
#include <string.h> 
#include <stdlib.h> 
#include <time.h> 
#include <libxml/xmlmemory.h> 
#include <libxml/parser.h> 
#include <mysql/mysql.h> 

而且這些都是錯誤的:如果妳想看intire程序

gcc -L/usr/lib/i386-linux-gnu -lxml2 -lmysqlclient -o ice2mysql2 ice2mysql2.c 

/tmp/ccs0iJn4.o: In function `toMysql': 
ice2mysql2.c:(.text+0x32d): undefined reference to `mysql_init' 
ice2mysql2.c:(.text+0x373): undefined reference to `mysql_real_connect' 
ice2mysql2.c:(.text+0x38f): undefined reference to `mysql_query' 
ice2mysql2.c:(.text+0x39d): undefined reference to `mysql_close' 
/tmp/ccs0iJn4.o: In function `parseGlobalStats': 
ice2mysql2.c:(.text+0x3f1): undefined reference to `xmlStrcmp' 
ice2mysql2.c:(.text+0x412): undefined reference to `xmlNodeListGetString' 
/tmp/ccs0iJn4.o: In function `parseStreamNet': 
ice2mysql2.c:(.text+0x44f): undefined reference to `xmlStrcmp' 
ice2mysql2.c:(.text+0x493): undefined reference to `xmlStrcmp' 
ice2mysql2.c:(.text+0x4b4): undefined reference to `xmlNodeListGetString' 
ice2mysql2.c:(.text+0x4cf): undefined reference to `xmlStrcmp' 
ice2mysql2.c:(.text+0x4f0): undefined reference to `xmlNodeListGetString' 
ice2mysql2.c:(.text+0x50b): undefined reference to `xmlStrcmp' 
ice2mysql2.c:(.text+0x52c): undefined reference to `xmlNodeListGetString' 
/tmp/ccs0iJn4.o: In function `parseDoc': 
ice2mysql2.c:(.text+0x557): undefined reference to `xmlParseFile' 
ice2mysql2.c:(.text+0x598): undefined reference to `xmlDocGetRootElement' 
ice2mysql2.c:(.text+0x5d4): undefined reference to `xmlFreeDoc' 
ice2mysql2.c:(.text+0x60e): undefined reference to `xmlFreeDoc' 
collect2: ld returned 1 exit status 

林編譯與此

THE PROGRAM

我想知道發生了什麼,請幫助... Thx!

+0

對於我來說,它看起來像編譯器/連接器找不到編譯庫(在linux可能與的.so或.A擴展名的文件),將其鏈接至主程序。 – furas

回答

0

您鏈接到圖書館必須要提到的最後一個:

gcc -L/usr/lib/i386-linux-gnu -o ice2mysql2 ice2mysql2.c -lxml2 -lmysqlclient 
+0

THx,它的工作!拯救我的一天 – Neto

相關問題