VS2015是否会自动包含Windows SDK标头文件,而在VS2017中不包含Windows SDK标头文件?

发布于 2025-01-19 06:27:46 字数 372 浏览 2 评论 0原文

我有一个最初在 VS2015 中开发的 C++ 库,它使用 Windows SDK 8.1 内 Winsock2 的 SOCKET。解决方案文件是从 cmake 文件生成的,并且构建得非常好。 我使用相同的 cmake 文件在 VS2017 中再次创建解决方案。但是,除非添加 #include,否则无法编译它。在使用 SOCKET 的文件中。除非我显式包含 WinSock2.h 文件,否则它看起来不会获取 SOCKET 的定义。我不需要在 VS2015 中这样做。

我检查了项目属性,它们看起来相同并且都使用 Windows SDK 8.1。那么VS2015和VS2017有什么区别呢? VS2015自动包含windows SDK头文件但VS2017中不包含?

I have a C++ library originally developed in VS2015 which uses SOCKET from Winsock2 inside Windows SDK 8.1. The solution file is generated from a cmake file, and it builds perfectly fine.
I use the same cmake file to create the solution again in VS2017. However, I can not compile it unless I add #include <WinSock2.h> at the file where SOCKET is being used. It looks like it's not picking up the definition of SOCKET unless I explicitly include the WinSock2.h file. And I don't need to do that in VS2015.

I checked the project properties and they look the same and are both using Windows SDK 8.1. So what is the difference here with VS2015 and VS2017? Does VS2015 automatically include windows SDK header files but not in VS2017?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文