我正在尝试编译并运行msquic的示例程序。我下载了 openssl 最新版本的 msquic quic 并将其添加到我的项目文件夹中。
-sample.c
-msquic
-bin
-msquic.dll
-msquic.pdb
-include
-msquic_winuser.h
-msquic.h
-lib
-msquic.lib
g++ sample.c -I msquic/include -L msquic/lib -o main.exe
In file included from sample.c:47:
msquic/include/msquic.h:763:10: warning: 'cdecl' attribute only applies to function types [-Wattributes]
763 | _In_ _Pre_defensive_ HQUIC Handle,
| ^~~~~~~~~~~~~~~
msquic/include/msquic.h:762:13: error: typedef 'QUIC_SET_CONTEXT_FN' is initialized (use 'decltype' instead)
762 | (QUIC_API * QUIC_SET_CONTEXT_FN)(
| ^~~~~~~~~~~~~~~~~~~
msquic/include/msquic.h:763:10: error: '_Pre_defensive_' was not declared in this scope
763 | _In_ _Pre_defensive_ HQUIC Handle,
| ^~~~~~~~~~~~~~~
.... a lot more similar errors
我认为我没有以正确的方式编译代码。建议正确的方法。
msquic-repo:https://github.com/microsoft/msquic/
sample.c:https://github.com/microsoft/msquic/blob/main/src/tools/sample/sample.c
msquic(发布):https://github.com/microsoft/msquic/releases/tag/v2.2.2,https://github.com/microsoft/msquic/releases/download/v2.2.2 /msquic_windows_x64_Release_openssl.zip
Windows 11 家庭版,MinGW g++ 12.2.0 编译器
-I 和 -L 之后不应有空格: “-Imsquic/包括-Lmsquic/lib”