我正在从http://curl.haxx.se/download.html v7.34.0将cURL用于MinGW64,并从https://github.com/JosephP91/curlcpp和Qt 5.2.1使用cURL包装器
一旦我将库加载到.pro中,随车装载http://i.imgur.com/dLM68Nd.png就出现了与野生语法相关的错误,我真的怀疑这是与版本相关的,但是我不知道解决方案。
它在示例中令人讨厌的代码部分:
template<class T> class CurlError : public exception {
public:
CurlError(const string error, const T code) : error(error), code(code) {}
~CurlError() throw() {};
pair<string,T> what() noexcept;
private:
string error;
T code;
};
错误输出:
C:\Users\Brad2\Documents\GitHub\curlcpp\include\CurlError.h:25: error: expected ';' at end of member declaration
pair<string,T> what() noexcept;
^
最佳答案
以下是我在qt中的.pro
文件。您需要根据需要替换目录($$PWD
是项目根目录的qmake变量,而我在名为第三方的文件夹中将curlcpp作为git-submodule)
QMAKE_CXXFLAGS = -std=c++11
QMAKE_LFLAGS = -std=c++11
INCLUDEPATH += "$$PWD/thirdparty/curlcpp/include/"
LIBS += -L"$$PWD/thirdparty/curlcpp/build/src/" \
-lcurlcpp \
-lcurl
关于c++ - 将cURL库加载到Qt5后出现狂野错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23922917/