预处理器定义在 VS2019 C++ 中不起作用 [英] Preprocessor definitions not working in VS2019 C++
问题描述
我在 VisualStudio 2019 中有一个 QT 4.8 应用程序,无论我在活动配置预处理器定义中设置什么,它们似乎都不适用于该项目.
I have a QT 4.8 app in VisualStudio 2019 and no matter what I setup in the active configuration Preprocessor definitions, none of them seems to apply to the project.
如果我去检查应该对当前文件应用什么,它似乎有它,但 Visual Studio 显示#ifdef 为灰色,#else 处于活动状态,这不应该是真的.
If I go to check what should be applied to the current file, it seems to have it, but visual studio shows the #ifdef in gray and the #else active, which should not be true.
可能是什么问题?
推荐答案
您确定 KREATOR_DEBUG 在您的所有项目中都定义了吗?
Are you sure KREATOR_DEBUG was defined in all your projects?
根据我的经验,如果您使用
In my experience if you use
#ifdef KREATOR_DEBUG
...
#endif
在一个 lib 项目的源文件和另一个项目(dll 或 exe 项目)中使用的 lib 中,KREATOR_DEBUG 预处理器定义应该同时在 lib 项目和另一个项目中定义.
in a lib project's source file and the lib used in another project (dll or exe project) then KREATOR_DEBUG Preprocessor Definition should be defined both in the lib project and the other project as well.
这篇关于预处理器定义在 VS2019 C++ 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!