Я установил paho-mqttpp3: x64-windows с помощью vcpkg и запустил приведенный ниже код в Visual Studio с опцией сборки в x64.
#include <iostream>
#include "mqtt/async_client.h"
int main()
{
std::cout << "Hello World!\n";
}
Когда я запускаю код выше, он генерирует следующую ошибку
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> error C2059: syntax error: 'const'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(85):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(85):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(85):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(85):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(109):
> error C3646: 'data': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(109):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(110):
> error C3646: 'value': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(110):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(123):
> error C2143: syntax error: missing ';' before '*'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(123):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(123):
> error C2238: unexpected token(s) preceding ';'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(141):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(141):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(141):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(141):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(141):
> error C2143: syntax error: missing ',' before '*'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(164):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(164):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(164):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(164):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(171):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(171):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(171):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(171):
> error C2146: syntax error: missing ';' before identifier
> 'MQTTProperties'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(179):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(179):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(179):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(179):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(188):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(188):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(188):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(188):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(196):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(196):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(196):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(196):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(206):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(206):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(206):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(206):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(214):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(214):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(214):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(214):
> error C2146: syntax error: missing ';' before identifier
> 'MQTTProperty'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(223):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(223):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(223):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(223):
> error C2146: syntax error: missing ';' before identifier
> 'MQTTProperty'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttreasoncodes.h(83):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttreasoncodes.h(83):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttreasoncodes.h(83):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttreasoncodes.h(83):
> error C2059: syntax error: 'const'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(223):
> error C3646: 'popen': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(223):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(227):
> error C3646: 'pclose': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(227):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(231):
> error C3646: 'pput': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(231):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(235):
> error C3646: 'pget': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(235):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(239):
> error C3646: 'premove': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(239):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(243):
> error C3646: 'pkeys': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(243):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(247):
> error C3646: 'pclear': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(247):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(251):
> error C3646: 'pcontainskey': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttclientpersistence.h(251):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C2065: 'MQTTAsync_init_options': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C2065: 'inits': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(233):
> error C2182: 'MQTTAsync_global_init': illegal use of type 'void'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(346):
> error C2061: syntax error: identifier 'MQTTAsync_message'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(366):
> error C2061: syntax error: identifier 'MQTTAsync_token'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(424):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(424):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(424):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(424):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(424):
> error C2065: 'MQTTAsync': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(424):
> error C2146: syntax error: missing ')' before identifier 'handle'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(431):
> error C3646: 'token': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(431):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(447):
> error C3646: 'token': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(447):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(466):
> error C3646: 'token': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(466):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(477):
> error C3646: 'message': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(477):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(497):
> error C3646: 'token': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(497):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(512):
> error C3646: 'message': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(512):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(543):
> error C2061: syntax error: identifier 'MQTTAsync_successData'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(556):
> error C2061: syntax error: identifier 'MQTTAsync_successData5'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(568):
> error C2061: syntax error: identifier 'MQTTAsync_failureData'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(580):
> error C2061: syntax error: identifier 'MQTTAsync_failureData5'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(594):
> error C2143: syntax error: missing ';' before '*'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(594):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(594):
> error C2238: unexpected token(s) preceding ';'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(600):
> error C2143: syntax error: missing ';' before '*'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(600):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(600):
> error C2238: unexpected token(s) preceding ';'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(612):
> error C3646: 'token': unknown override specifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(612):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(618):
> error C2143: syntax error: missing ';' before '*'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(618):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(618):
> error C2238: unexpected token(s) preceding ';'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(624):
> error C2143: syntax error: missing ';' before '*'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(624):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(624):
> error C2238: unexpected token(s) preceding ';'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(677):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(677):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(677):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(677):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(677):
> error C2065: 'MQTTAsync': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(677):
> error C2146: syntax error: missing ')' before identifier 'handle'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(700):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(700):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(700):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(700):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(700):
> error C2065: 'MQTTAsync': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(700):
> error C2146: syntax error: missing ')' before identifier 'handle'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(724):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(724):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(724):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(724):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(724):
> error C2065: 'MQTTAsync': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(724):
> error C2146: syntax error: missing ')' before identifier 'handle'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(746):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(746):
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(746):
> error C2374: '__attribute__': redefinition; multiple initialization
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttproperties.h(67):
> note: see declaration of '__attribute__'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(746):
> error C2448: '__attribute__': function-style initializer appears to be
> a function definition
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(746):
> error C2065: 'MQTTAsync': undeclared identifier
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(746):
> error C2146: syntax error: missing ')' before identifier 'handle'
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(761):
> error C3861: 'visibility': identifier not found
> 1>d:\vcpkg\packages\paho-mqtt_x64-windows\include\paho-mqtt\mqttasync.h(761):
> fatal error C1003: error count exceeds 100; stopping compilation
Но когда я установил paho-mqttpp3: x86-windows с помощью vcpkg и запустил тот же код в Visual Studio с опцией сборки в x86. Он успешно запустился.
#include <iostream>
#include "mqtt/async_client.h"
int main()
{
std::cout << "Hello World!\n";
}
ОС - Windows 10, 64-разрядная версия, Домашняя
Visual Studio - 15.9.19
paho-mqtt устанавливается с помощью vcpkg.
__attribute__
- это специальное расширение компиляторов GCC и Clang, в Visual Studio их нет. Таким образом, похоже, что в вашей установке пакетаpaho-mqttpp3:x64-windows
произошла некоторая неправильная конфигурация. Если это на вашей стороне, или ошибка сопровождающих пакета (или где-то еще), я не знаю. - person Some programmer dude   schedule 15.01.2020