gpt4 book ai didi

c++ - 如何在编译时检测WP8

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:21:32 26 4
gpt4 key购买 nike

我正在开发一个跨平台的 C++ 库。我的目标是 WP8,我需要检测目标是 WP8 还是桌面 Windows。

是否有为 WP8 目标自动设置的标志?

我考虑过使用 _WIN32,但它似乎在两个平台上都有定义。

最佳答案

不确定这是否是您要查找的内容,但如果您正在做一个通用应用程序/可移植库,您可以使用

检测到它

C++

来自 winapifamily.h

/*
* When compiling C and C++ code using SDK header files, the development
* environment can specify a target platform by #define-ing the
* pre-processor symbol WINAPI_FAMILY to one of the following values.
* Each FAMILY value denotes an application family for which a different
* subset of the total set of header-file-defined APIs are available.
* Setting the WINAPI_FAMILY value will effectively hide from the
* editing and compilation environments the existence of APIs that
* are not applicable to the family of applications targeting a
* specific platform.
*/

#define WINAPI_FAMILY_PC_APP 2 /* Windows Store Applications */
#define WINAPI_FAMILY_PHONE_APP 3 /* Windows Phone Applications */
#define WINAPI_FAMILY_DESKTOP_APP 100 /* Windows Desktop Applications */


// example usage
#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
// TODO:
#endif

C#

#if WINDOWS_APP
// TODO
#endif

#if WINDOWS_PHONE_APP
// TODO
#endif

关于c++ - 如何在编译时检测WP8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25573752/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com