Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

This has now cost me quite some time, so in case anybody else has this problem, here it is:

I have a C++ project using Visual Studio 2013, and with the CPP Rest SDK. Now we start using Qt (version 5.6), so I added Qt objects to the code.

I kept getting this error message:

C:\Qt\Qt5.6.0\5.6\msvc2013_64\include\QtCore/qtypetraits.h(523): warning C4003: not enough actual parameters for macro 'U'
C:\Qt\Qt5.6.0\5.6\msvc2013_64\include\QtCore/qtypetraits.h(523): warning C4003: not enough actual parameters for macro '_XPLATSTR'
C:\Qt\Qt5.6.0\5.6\msvc2013_64\include\QtCore/qtypetraits.h(523): error C2061: syntax error : identifier 'L'
          C:\Qt\Qt5.6.0\5.6\msvc2013_64\include\QtCore/qtypetraits.h(527) : see reference to class template instantiation 'QtPrivate::is_default_constructible<T>' being compiled
like image 681
Robin Avatar asked Mar 12 '23 07:03

Robin


1 Answers

It's not Qt's fault. It's the CPP Rest SDK. It defines a macro U, which is happily replaced for a U template parameter in qtypetraits.h.

When I define _TURN_OFF_PLATFORM_STRING in the C++ preprocessor definitions, the error disappears.

like image 136
Robin Avatar answered Mar 29 '23 22:03

Robin