MSQUIC GCC 编译示例程序

问题描述 投票:0回答:1

我正在尝试编译并运行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.2https://github.com/microsoft/msquic/releases/download/v2.2.2 /msquic_windows_x64_Release_openssl.zip

有关我的系统的更多信息:

Windows 11 家庭版,MinGW g++ 12.2.0 编译器

c++ gcc g++ mingw quic
1个回答
0
投票

-I 和 -L 之后不应有空格: “-Imsquic/包括-Lmsquic/lib”

© www.soinside.com 2019 - 2024. All rights reserved.