2013-07-02 51 views
0

我正在将我的Windows控制台应用程序移植到Linux(Ubuntu 12.04)。我正在使用GNU GCC编译器来编译我的应用程序。然而,我似乎无法摆脱一些错误,这个代码在Windows中使用libxml2的功能,但不能在这里编译。编译在Ubuntu的代码块中的Libxml2时出错

在我的构建选项中,我已经包含了搜索路径usr/include/libxml2。当我编译我仍然收到错误:

Datadictionary.c|| undefined reference to `xmlCheckVersion'| 
    Datadictionary.c|| undefined reference to `xmlStrcmp'| 
    Datadictionary.c|| undefined reference to `xmlGetProp'|  
    Datadictionary.c|| undefined reference to `xmlReadFile'| 

现在我看了任何地方,但找不到解决方案。

请帮忙。

回答

1

您需要安装

sudo apt-get install libxml2
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install xml-core

然后,你需要设置compliler选项 - I/usr/include目录/ libxml2的
和连接选项-lxml2 -lm

并使用# include<libxml/parser.h> instead #include "libxml/parser.h"

还需要清除所有以前的搜索路径设置

+0

请,你能解释一下怎么样? 'make -l/usr(包括...'或'./configure/usr(include ...')等谢谢 –