gpt4 book ai didi

c++ - 基于 Windows 操作系统执行条件函数

转载 作者:行者123 更新时间:2023-11-28 03:31:28 25 4
gpt4 key购买 nike

<分区>

我想知道如何根据我使用的操作系统执行条件函数,例如,

if ( operatingSystem == Windows7 )
{
foo()
}
else if ( operatingSystem == WindowsXP )
{
etc()
}

我很确定预定义的宏不会帮助我,因为你必须在编译之前选择操作系统宏,我希望这个程序是灵活的,不幸的是预处理器宏是我在谷歌上得到的唯一答案它。感谢您的时间!

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