我正在使用cpprest与Qt Creator 4.2.1基于Qt 5.8.0(MSVC 2015,32位) .
我修改了 .pro
文件以表明
INCLUDEPATH += C:/cpprest/Release/include
我收到以下错误:
mainwindow.obj:-1:错误:LNK2019:未解析的外部符号“_declspec(dllimport)类std :: basic_string,类std :: allocator> cdecl实用程序:: conversions :: to_string_t(类std :: basic_string,class std: :allocator> const&)“( imp?to_string_t @ conversions @ utility @@ YA?AV?$ basic_string @ _WU?$ char_traits @ _W @ std @@ V?$ allocator @ _W @ 2 @@ std @@ AEBV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ 4 @@ Z)在函数“class web :: uri __cdecl generateOMDBQuery(class std :: basic_string,class std :: allocator)中引用> const&)“(?generateOMDBQuery @@ YA?AVuri @ web @@ AEBV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@@ Z)
按照this回答我需要设置
Treat wchar_t was Built-in Type 至 No in C/C++ -> Language.
直到我明白这是Visual Studios的设置 . 我如何在 QT creator 中设置此项?
1 回答
我赞同使用命令行构建的“AlexanderVX”评论 .
这是为了解决你的问题,我的意思是设置选项 - “在C / C中将wchar_t内置类型处理为否 - >语言” .
这个设置我不确定“QtCreator” .
但是如果你去编写命令行,可以在QMake中设置它 .
For windows build (MSDN documentation):
/Zc:wchar_t
用于治疗"WChar_t As Built in type" ./Zc:wchar_t-
适用于 not 治疗"WChar_t As Built in type" .这些设置可以在Windows操作系统的相应QMake文件中完成 .
您可以在“mkspecs \ win32-msvc2010”中找到该文件(版本号可能会有所不同)
对于Qt4.8我看到他们,
在记事本中打开make文件,找到"QMAKE_CFLAGS",然后添加"-Zc:wchar_t-"选项,如下所示 . Be watchful of negative sign