C2061:语法错误:qtypetraits.h 中的标识符'L'

C2061: syntax error : identifier 'L' in qtypetraits.h

本文关键字:标识符 语法 错误 qtypetraits C2061      更新时间:2023-10-16

这已经花费了我相当长的时间,所以如果其他人有这个问题,这里是:

我有一个使用Visual Studio 2013和CPP Rest SDK的C++项目。现在我们开始使用Qt(版本5.6),所以我在代码中添加了Qt对象。

我一直收到这个错误消息:

C:QtQt5.6.05.6msvc2013_64includeQtCore/qtypetraits.h(523): warning C4003: not enough actual parameters for macro 'U'
C:QtQt5.6.05.6msvc2013_64includeQtCore/qtypetraits.h(523): warning C4003: not enough actual parameters for macro '_XPLATSTR'
C:QtQt5.6.05.6msvc2013_64includeQtCore/qtypetraits.h(523): error C2061: syntax error : identifier 'L'
          C:QtQt5.6.05.6msvc2013_64includeQtCore/qtypetraits.h(527) : see reference to class template instantiation 'QtPrivate::is_default_constructible<T>' being compiled

这不是Qt的错。这是CPP Rest SDK。它定义了一个宏U,它很高兴地被qtypetracts.h中的U模板参数所取代。

当我在C++预处理器定义中定义_TURN_OFF_PLATFORM_STRING时,错误消失了。