使用xmlrpc的未定义引用错误

时间:2013-04-01 22:44:42

标签: c++ qt linker undefined xml-rpc

我正在尝试在QT-Creator中使用XML-RPC客户端示例,并且正在获取我似乎能够解决的链接错误。

main.cpp中:

#include <cstdlib>
#include <string>
#include <iostream>
#include <xmlrpc-c/girerr.hpp>
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/client_simple.hpp>

using namespace std;

int
main(int argc, char **) {

    if (argc-1 > 0) {
        cerr << "This program has no arguments" << endl;
        exit(1);
    }

    try {
        string const serverUrl("http://localhost:8080/RPC2");
        string const methodName("sample.add");

        xmlrpc_c::clientSimple myClient;
        xmlrpc_c::value result;

        myClient.call(serverUrl, methodName, "ii", &result, 5, 7);

        int const sum = xmlrpc_c::value_int(result);
            // Assume the method returned an integer; throws error if not

        cout << "Result of RPC (sum of 5 and 7): " << sum << endl;

   } catch (exception const& e) {
        cerr << "Client threw error: " << e.what() << endl;
    } catch (...) {
        cerr << "Client threw unexpected error." << endl;
    }

    return 0;
}

.pro文件:

#-------------------------------------------------
#
# Project created by QtCreator 2013-04-02T00:25:47
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = Mark2
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/release/ -lxmlrpc++
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/debug/ -lxmlrpc++
else:unix: LIBS += -L$$PWD/../../../../../../usr/lib/ -lxmlrpc++

INCLUDEPATH += $$PWD/../../../../../../usr/include
DEPENDPATH += $$PWD/../../../../../../usr/include


win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/release/ -lxmlrpc_client++
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/debug/ -lxmlrpc_client++
else:unix: LIBS += -L$$PWD/../../../../../../usr/lib/ -lxmlrpc_client++

INCLUDEPATH += $$PWD/../../../../../../usr/include
DEPENDPATH += $$PWD/../../../../../../usr/include

直接来自http://xmlrpc-c.sourceforge.net/doc/#clientexamplepp

我收到以下错误:

  

错误:未定义引用`xmlrpc_c :: clientSimple :: clientSimple()'

如你所见,我已经包括

  

XMLRPC-C / client_simple.hpp

提供clientSimple的定义。 我已经通过ubuntu软件中心“libxmlrpc-c ++ 4-dev”和“xmlrpc-api-utils”安装了xmlrpc库

我错过了什么?任何帮助将非常感谢!

0 个答案:

没有答案