mqtt ubutun下编译windows步骤

本文详细记录了使用CMake与Ninja构建系统为Paho MQTT C++库进行跨平台编译的过程,包括定义编译器、检测编译器ABI信息、配置CMake版本及系统名称等步骤,并展示了特定于Windows平台的编译指令与依赖库链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

apt-get install ninja-build
cmake -GNinja -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_TOOLCHAIN_FILE=/home/git/paho.mqtt.cpp/paho.mqtt.c/cmake/toolchain.win64.cmake /home/git/paho.mqtt.cpp/paho.mqtt.c
-- The C compiler identification is GNU 4.8.2
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- CMake version: 2.8.12.2
-- CMake system name: Windows
-- Timestamp is 2019-04-17T12:12:03Z
-- Configuring done
-- Generating done
-- Build files have been written to: /home
cp /usr/x86_64-w64-mingw32/include/windows.h /usr/x86_64-w64-mingw32/include/Windows.h
cp /usr/x86_64-w64-mingw32/include/wincrypt.h /usr/x86_64-w64-mingw32/include/WinCrypt.h
cp /usr/x86_64-w64-mingw32/include/rpc.h /usr/x86_64-w64-mingw32/include/Rpc.h
if ( CryptBinaryToStringA( in, in_len, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, out, &dw_out_len ) )                                  /usr/x86_64-w64-mingw32/lib/libcrypt32.a
#define CRYPT_STRING_NOCRLF 0x40000000
#define CRYPT_STRING_NOCR 0x80000000   (WinCrypt.h)
(WebSocket.c)    #define HTONLL(x) ((1==htonl(1)) ? (x) : (((uint64_t)htonl((x) & 0xFFFFFFFFUL)) << 32) | htonl((uint32_t)((x) >> 32)))
#define NTOHLL(x) ((1==ntohl(1)) ? (x) : (((uint64_t)ntohl((x) & 0xFFFFFFFFUL)) << 32) | ntohl((uint32_t)((x) >> 32)))
undefined reference to `__imp_UuidCreate'    (-lcrypt32   )
DEFINES = -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_WINDOWS  (添加宏_WINDOWS)
LINK_LIBRARIES = src/libpaho-mqtt3a.dll.a -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lrpcrt4 -lcrypt32

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值