gpt4 book ai didi

c++ - 如何为 Visual Studio 编译器指定自定义编译器标志

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

通过 GCC,您可以使用 -D<custom flag>例如,将值传递给您在代码中定义的宏。但是我找不到关于如何为 VSC 执行此操作的任何信息。有人知道吗?

因此,GCC 案例的示例如下所示:

g++ -DMYFLAG=1 program.cpp

最佳答案

But I can't find any information on how to do this for the VSC.

我觉得很难相信。 https://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx是我在谷歌搜索“visual studio macro command line”时得到的第一个结果。否则,F1 或搜索 MSDN 仍会为您提供相同的答案。

/D (Preprocessor Definitions)

Defines a preprocessing symbol for a source file.

Syntax

/Dname[= | # [{string | number}] ]

关于c++ - 如何为 Visual Studio 编译器指定自定义编译器标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33314125/

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