简体   繁体   中英

WinUI 3, C++ And Winsock API Will Not Compiling

I am attempting to create a WinUI application (NOT UWP) to incorporate the Winsock api using the Win32 C++ APIs. I get all the usual compiler errors associated with the winsock header files. I have implemented all the usual fixes; WINDOWS_LEAN_AND_MEAN, order of header file inclusion etc. etc. I still get hundreds of compiler errors in the ws2xxxx.h files.

My question is threefold:

  1. Am I trying to do something that Microsoft have not yet implemented/figured out?

  2. Have I strayed from the path of wisdom?

  3. Should I give up? When all the other excellent and well documented Win32 APIs have no issues.

I like the idea of using the power of the WinUI XAML UI combined with the power of the Win32 APIs.

Has anyone else tried this, or does anyone have any insight as to how to get the compiler to do its job?

Please be sure to /dWIN32_LEAN_AND_MEAN (not WINDOWS_LEAN_AND_MEAN) at a project level (vs. just typing #define somewhere).

And as Remy asked, let's start with what compiler errors you're seeing. If you are using other networking headers such as iphlpapi.h or netioapi.h, they might have some preconditions that you have already included some other header networking header (yeah, some of these other headers required you have included something else before it, what a pain).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM