![](/img/trans.png)
[英]Vscode C++ debugging code built with cl.exe and / link.exe - debugger doesn't attach
[英]Configuring Qt .pro file to use cl.exe and link.exe to fix linking errors
作為Qt項目的一部分,我有一個WSO2 WSF / C ++模塊作為Web服務。 現在,在CLI(Windows環境)中,構建此模塊的說明非常簡單:
編譯:
cl.exe /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "AXIS2_DECLARE_EXPORT" /D "AXIS2_SVR_MULTI_THREADED" /w /nologo /I %WSFCPP_HOME%\\include /c hello.cpp
鏈接:
link.exe /nologo /LIBPATH:%WSFCPP_HOME%\\lib axutil.lib axiom.lib axis2_parser.lib axis2_engine.lib wso2_wsf.lib /DLL /OUT:hello.dll *.obj
為了自動化構建過程,我想將這些步驟集成到我的.pro文件中。 但是我絕對不知道如何進行。 有什么建議么?
編輯:這是我當前的代碼:
project.pro
TEMPLATE = lib
CONFIG += dll
CONFIG -= qt
VERSION = 1.0
TARGET = hello
SOURCES += hello.cpp
HEADERS += hello.hpp
DEFINES += AXIS2_DECLARE_EXPORT AXIS2_SVR_MULTI_THREADED
INCLUDEPATH += "C:\wsfcpp\include"
LIBS += \
-L"C:\wsfcpp\lib" -laxutil \
-laxiom \
-laxis2_parser \
-laxis2_engine \
-lwso2_wsf
你好
#ifndef HELLO_H
#define HELLO_H
#include <ServiceSkeleton.h>
using namespace wso2wsf;
class Hello : public ServiceSkeleton
{
public:
WSF_EXTERN WSF_CALL Hello(){};
OMElement* WSF_CALL invoke(OMElement *message, MessageContext *msgCtx);
OMElement* WSF_CALL onFault(OMElement *message);
void WSF_CALL init();
OMElement* greet(OMElement *inMsg);
};
#endif // HELLO_H
你好
#include <ServiceSkeleton.h>
#include <iostream>
#include <stdio.h>
#include <axutil_env.h>
#include <Environment.h>
#include <OMText.h>
#include "hello.hpp"
using namespace wso2wsf;
using namespace std;
/** Load the service into axis2 engine */
WSF_SERVICE_INIT(Hello)
OMElement* Hello::invoke(OMElement *ele, MessageContext *msgCtx)
{
return greet(ele);
}
OMElement* Hello::onFault(OMElement *ele)
{
OMElement *responseEle = new OMElement("HelloServiceErrorResponse");
responseEle->setText("Hello Service Failed");
return responseEle;
}
void Hello::init()
{
}
OMElement* Hello::greet(OMElement* inMsg)
{
OMElement *helloEle = new OMElement("greetResponse");
OMElement *text = new OMElement("text");
helloEle->setText(greet);
return helloEle;
}
創建一個.pro文件,如下所示:
TEMPLATE = lib
TARGET = hello
DEFINES += AXIS2_DECLARE_EXPORT AXIS2_SVR_MULTI_THREADED
SOURCES += hello.cpp
LIBS += -Lpath/to/the/libs -laxutil -laxiom -laxis2_parser -laxis2_engine -lwso2_wsf
並將其集成到您的構建過程中。 這將要求您使用的Qt / qmake為MSVC進行編譯。 (但是在單個項目中混合使用mingw和MSVC還是行不通的)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.