'Error: Cannot open include file: 'MQTTAsync.h': No such file or directory

OS -Windows 10 x64

Library mqtt Microsoft Visual Studio Community 2017 Version 15.9.15

Programming Language - C++17

Installed paho-mqtt paho-mqttpp3 paho-mqttpp3[ssl] using vcpkg

I am creating a c++ program using mqtt. But whenever I am using below given header

#include <mqtt/async_client.h>

It is giving following error

d:\vcpkg\installed\x64-windows\include\mqtt\async_client.h(27): fatal error C1083: Cannot open include file: 'MQTTAsync.h': No such file or directory

But MQTTAsync.h file is available on the given location D:\vcpkg\installed\x64-windows\include\paho-mqtt

I had followed below link by creating new console project

https://github.com/Microsoft/vcpkg/issues/1848

Still issue is not getting resolved



Solution 1:[1]

Verify the correct name in your vcpkg-directory.

In my case that would be C:\Users\USERNAME\vcpkg\installed\x64-windows\include\paho-mqtt

Here you will see that the header file you are looking for is actually called MQTTAsync.h

To add it in your project you will have to change your inlcude to #include <paho-mqtt/MQTTAsync.h>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 flololan