qt app html,如何创建QtWebApp应用程序

我想用QtWebApp创建一个简单的Web应用程序服务器,但它显示一些错误,我无法解决如何解决,任何提示如何解决这个问题?如何创建QtWebApp应用程序

这是我做了什么:

下载QtWebApp-src.zip =使用qmake和make编译QtWebApp,成功地完成了

=创建一个新的qwtest.pro,包含:

QT += core network

QT -= gui

TARGET = qwtest

CONFIG += console

CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

=创建源文件main.cpp,包含:

#include "../v1.3.2 2014-01-08/lib/bfHttpServer/src/httplistener.h"

#include

class MyController: public HttpRequestHandler {

private:

QCoreApplication *app;

public:

MyController(QCoreApplication *app) : app(app) {}

void service(HttpRequest& request, HttpResponse& response);

};

void MyController::service(HttpRequest& request, HttpResponse& response) {

QByteArray path=request.getPath();

QByteArray username=request.getParameter("username");

response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");

response.setCookie(HttpCookie("myCookie","any value",600));

response.write("

");

response.write("Hello ");

response.write(username);

response.write("");

}

int main(int argc, char *argv[]) {

QCoreApplication* app=new QCoreApplication(argc,argv);

QSettings* settings=new QSettings("configfile.ini",QSettings::IniFormat,app);

MyController* controller=new MyController(app);

HttpListener* listener=new HttpListener(settings,controller,app);

return app->exec();

}

=编译使用qmake和make

/home/foo/qtwebapp/build-QtWebApp-Desktop-Debug/../v1.3.2 2014-01-08/src/main.cpp:66: undefined reference to `Startup::Startup(int, char**)'

/home/foo/qtwebapp/build-QtWebApp-Desktop-Debug/../v1.3.2 2014-01-08/src/main.cpp:67: undefined reference to `QtServiceBase::exec()'

main.o:(.data.rel.ro._ZTV9QtServiceI16QCoreApplicationE[_ZTV9QtServiceI16QCoreApplicationE]+0x28): undefined reference to `QtServiceBase::stop()'

main.o:(.data.rel.ro._ZTV9QtServiceI16QCoreApplicationE[_ZTV9QtServiceI16QCoreApplicationE]+0x30): undefined reference to `QtServiceBase::pause()'

main.o:(.data.rel.ro._ZTV9QtServiceI16QCoreApplicationE[_ZTV9QtServiceI16QCoreApplicationE]+0x38): undefined reference to `QtServiceBase::resume()'

main.o:(.data.rel.ro._ZTV9QtServiceI16QCoreApplicationE[_ZTV9QtServiceI16QCoreApplicationE]+0x40): undefined reference to `QtServiceBase::processCommand(int)'

main.o: In function `Startup::~Startup()':

/home/foo/qtwebapp/build-QtWebApp-Desktop-Debug/../v1.3.2 2014-01-08/src/startup.h:16: undefined reference to `vtable for Startup'

main.o: In function `QtService::~QtService()':

/home/foo/qtwebapp/build-QtWebApp-Desktop-Debug/../v1.3.2 2014-01-08/lib/qtservice/src/qtservice.h:170: undefined reference to `QtServiceBase::~QtServiceBase()'

main.o:(.data.rel.ro._ZTI9QtServiceI16QCoreApplicationE[_ZTI9QtServiceI16QCoreApplicationE]+0x10): undefined reference to `typeinfo for QtServiceBase'

collect2: error: ld returned 1 exit status

Makefile:182: recipe for target 'qwtest' failed

2014-02-07

Kokizzu

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值