I am on a 64 bit Windows 11 Professional system running 64 bit Visual Studio 2022 version 17.2.5 Community Edition.
I am working on a project which uses boost asio and beast (version 1_79_0) which does not compile regardless whether the "C++ Language Standard" property set to /std:c++14 or /std:c++17 or /std:c++20 or /std:c++latest (preview).
Both Visual Studio and Boost are "fresh installs". Is this a known incompatibility or is there some other project property or preprocessor macro that I need to set?
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(40,28): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(40,28): error C2062: type 'int' unexpected
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(88): message : see reference to class template instantiation 'boost::date_time::wrapping_int<int_type_,wrap_val>' being compiled
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(40,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(114,28): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(114,28): error C2062: type 'int' unexpected
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(161): message : see reference to class template instantiation 'boost::date_time::wrapping_int2<int_type_,wrap_min,wrap_max>' being compiled
1>E:\boost_1_79_0\boost\date_time\wrapping_int.hpp(114,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(84,33): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(111,33): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): error C2760: syntax error: '*' was unexpected here; expected 'id-expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(116): message : see reference to class template instantiation 'boost::date_time::month_functor<date_type>' being compiled
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): error C2760: syntax error: '*' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): error C3878: syntax error: unexpected token '*' following 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): message : error recovery skipped: '*'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): error C2760: syntax error: ')' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(75,75): message : error recovery skipped: ') ) ) . . . )'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C2760: syntax error: '*' was unexpected here; expected 'id-expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token '(' following 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): message : error recovery skipped: '( ( int . . . *'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token ')' following 'jump_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token ')' following 'statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token ')' following 'statement_seq'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): message : missing one of: '}' ?
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C2760: syntax error: ')' was unexpected here; expected '}'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token ')' following 'compound_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token ')' following 'selection_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C2760: syntax error: ')' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,35): message : error recovery skipped: ') ) ,'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,67): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,67): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(78,67): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): error C2760: syntax error: '*' was unexpected here; expected 'id-expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): error C2760: syntax error: '*' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): error C3878: syntax error: unexpected token '*' following 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): message : error recovery skipped: '*'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): error C2760: syntax error: ')' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(102,75): message : error recovery skipped: ') ) ) . . . )'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C2760: syntax error: '*' was unexpected here; expected 'id-expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token '(' following 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): message : error recovery skipped: '( ( int . . . *'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token ')' following 'jump_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token ')' following 'statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token ')' following 'statement_seq'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): message : missing one of: '}' ?
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C2760: syntax error: ')' was unexpected here; expected '}'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token ')' following 'compound_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token ')' following 'selection_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C2760: syntax error: ')' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,35): message : error recovery skipped: ') ) ,'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,67): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,67): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\adjust_functors.hpp(105,67): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): warning C4003: not enough arguments for function-like macro invocation 'as_int'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): error C2760: syntax error: '*' was unexpected here; expected 'id-expression'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(221): message : see reference to class template instantiation 'boost::date_time::split_timedate_system<config>' being compiled
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): error C3878: syntax error: unexpected token '(' following 'expression'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): message : error recovery skipped: '( ( int . . . *'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): error C3878: syntax error: unexpected token ')' following 'jump_statement'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): error C2760: syntax error: ')' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(185,64): message : error recovery skipped: ') ) ) . . . )'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): error C2760: syntax error: '*' was unexpected here; expected 'id-expression'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): error C3878: syntax error: unexpected token '(' following 'expression'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): message : error recovery skipped: '( ( int . . . *'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): error C2760: syntax error: ')' was unexpected here; expected ';'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): error C3878: syntax error: unexpected token ')' following 'jump_statement'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): message : error recovery skipped: ')'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): error C2760: syntax error: ')' was unexpected here; expected 'expression'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>E:\boost_1_79_0\boost\date_time\time_system_split.hpp(203,64): message : error recovery skipped: ') ) ) . . . )'
This 2.5 years old SO question provides a solution to include concepts but I do not know where to include the preprocessor directive.
Understandably if you browse all the way down on the Release Notes of boost version_1_79_0 then under Compilers Tested->Windows: the last version is 14.2 which is Visual Studio 2019 since Visual Studio 2022 was not stably released at that time.
I've have been a C# dev and C++ is not my forte (first timer) therefore any directions on solving this has to be detailed.
Thank you in advance for your time.
The order of the includes was the culprit.
I was using boost asio and boost beast with another c++ framework and once I moved those includes all the way down the boost errors disappeared.
I had also opened an issue with boost library on github, closed that issue as well.
Hope it helps people with similar issues.
Bonus Tip
I have started using cpr library in place of boost beast. Saves me a lot of heartaches.
OS: Ubuntu 18.04
Qt: 5.15.2 (minimal built from source)
QGroundControl: 4.2
I am building QGroundControl from source. I have also built qgc required qt5.15.2.
Inside qgroundcontrol/build:
$> qmake ..
Project MESSAGE: Qt version 5.15.2
Project MESSAGE: Linux build
Project MESSAGE: Daily Build
Project MESSAGE: GIT_DESCRIBE v4.2.3
Project MESSAGE: QGroundControl APP_VERSION_STR VERSION v4.2.3 4.2.3
Project MESSAGE: Release flavor
Project MESSAGE: Skipping support for Pairing
Project MESSAGE: Using MAVLink dialect 'ardupilotmega'.
Project MESSAGE: Skipping support for Zeroconf (unsupported platform)
Project MESSAGE: Including support for AirMap
Project MESSAGE: Taisync disabled
Project MESSAGE: Microhard disabled
Project MESSAGE: Including support for video streaming
Project MESSAGE: This project is using private headers and will therefore be tied to this specific Qt module build version.
Project MESSAGE: Running this project against other versions of the Qt modules may crash at any arbitrary point.
Project MESSAGE: This is not a bug, but a result of using Qt internals. You have been warned!
$> make
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1188:27: error: expected type-specifier before ‘QTcpSocket’
1188 | auto socket = new QTcpSocket();
| ^~~~~~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1193:26: error: ‘QTcpSocket’ has not been declared
1193 | connect(socket, &QTcpSocket::connected, this, [this, socket] {
| ^~~~~~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp: In lambda function:
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1196:13: error: ‘socket’ is not captured
1196 | socket->deleteLater();
| ^~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1193:68: note: the lambda has no capture-default
1193 | connect(socket, &QTcpSocket::connected, this, [this, socket] {
| ^
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1188:14: note: ‘<typeprefixerror>socket’ declared here
1188 | auto socket = new QTcpSocket();
| ^~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp: In lambda function:
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1201:13: error: ‘socket’ is not captured
1201 | socket->deleteLater();
| ^~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1198:77: note: the lambda has no capture-default
1198 | connect(socket, &QAbstractSocket::errorOccurred, this, [this, socket](QAbstractSocket::SocketError error) {
| ^
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1188:14: note: ‘<typeprefixerror>socket’ declared here
1188 | auto socket = new QTcpSocket();
| ^~~~~~
Makefile:135853: recipe for target 'QGCTileCacheWorker.o' failed
make: *** [QGCTileCacheWorker.o] Error 1
Is there anything I might be missing?
As #G.M. pointed the QGCTileCacheWorker.cpp was missing required header. I wonder why it was not originally added as I am using exact version of Qt which QGroundControl has specified.
Now another error pops up :
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/MapProvider.cpp:23:40: error: incomplete type ‘QLocale’ used in nested name specifier
23 | const QStringList langs = QLocale::system().uiLanguages();
| ^~~~~~
compiling /media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/EsriMapProvider.cpp
Makefile:137039: recipe for target 'MapProvider.o' failed
make: *** [MapProvider.o] Error 1
make: *** Waiting for unfinished jobs....
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp: In member function ‘void GoogleMapProvider::_tryCorrectGoogleVersions(QNetworkAccessManager*)’:
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:108:27: error: variable ‘QSslConfiguration conf’ has initializer but incomplete type
108 | QSslConfiguration conf = qheader.sslConfiguration();
| ^~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:108:42: error: ‘class QNetworkRequest’ has no member named ‘sslConfiguration’; did you mean ‘http2Configuration’?
108 | QSslConfiguration conf = qheader.sslConfiguration();
| ^~~~~~~~~~~~~~~~
| http2Configuration
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:109:32: error: ‘QSslSocket’ has not been declared
109 | conf.setPeerVerifyMode(QSslSocket::VerifyNone);
| ^~~~~~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:110:17: error: ‘class QNetworkRequest’ has no member named ‘setSslConfiguration’; did you mean ‘http2Configuration’?
110 | qheader.setSslConfiguration(conf);
| ^~~~~~~~~~~~~~~~~~~
| http2Configuration
Makefile:137340: recipe for target 'GoogleMapProvider.o' failed
make: *** [GoogleMapProvider.o] Error 1