xerces -c ++编译/链接问题

时间:2009-12-14 20:29:29

标签: c++ compiler-errors static-libraries linker-errors

安装Xerces-C ++(XML库)之后:

./configure --disable-shared
./make
./make-install
ldconfig

编写简单程序(xmlval.cpp):

#include <stdio>
#include <xercesc/dom/DOM.hpp>

int main()
{
    std::cout << "HI" << std::endl;
}

编译:

/usr/bin/g++ -L/usr/local/lib -I/usr/local/include -o xmlval xmlval.cpp /usr/local/lib/libxerces-c.a

编译结果有很多行,如:

/usr/local/lib/libxerces-c.a(CurlNetAccessor.o): In function `xercesc_3_0::CurlNetAccessor::cleanupCurl()':
/home/stullbd/xerces-c-3.0.1/src/xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp:78: undefined reference to `curl_global_cleanup'
/usr/local/lib/libxerces-c.a(CurlNetAccessor.o): In function `xercesc_3_0::CurlNetAccessor::initCurl()':
/home/stullbd/xerces-c-3.0.1/src/xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp:70: undefined reference to `curl_global_init'
/usr/local/lib/libxerces-c.a(CurlURLInputStream.o): In function `~CurlURLInputStream':
/home/stullbd/xerces-c-3.0.1/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp:168: undefined reference to `curl_multi_remove_handle'

对此有何想法?

1 个答案:

答案 0 :(得分:4)

您似乎错过了与curl的关联,请尝试添加-lcurl