在Qt Creator的preprocessor输出 [英] Preprocessor output on Qt Creator

查看:147
本文介绍了在Qt Creator的preprocessor输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写的 C $ C $ Qt Creator中C和我需要看看preprocessor输出。

I am compiling C code in Qt Creator and I need to look at the preprocessor output.

我添加了-E标志的牌子,但我没有看到。我*文件:

I added the -E flag to the make, but I don't see the *.i files:

mingw32-make.exe -e -w in \qt\qt-build-desktop

请帮忙。

推荐答案

-E是gcc的选择,而不是make选项,所以通过它来作什么都不会做。此外,使用-E工作正常单个文件,但不会生成正确的.o文件将将打破你的构建(它包含了preprocessed源)。
什么工作得很好,虽然是添加以下到.pro文件:

-E is a gcc option, not a make option, so passing it to make won't do anything. Also, using -E works fine for a single file, but will break your build as no proper .o file is generated (it contains the preprocessed source). What works fine though is adding the following to the .pro file:

QMAKE_CXXFLAGS += -save-temps

如果你建立你的项目,源文件Foo.cpp中的preprocessed源现在被保留为foo.ii.
(用make + GCC在OS X上测试,我认为它适用于MinGW的,太)。

Now if you build your project, the preprocessed source of source file foo.cpp is kept as foo.ii. (tested with make+gcc on OS X, I'd assume it works for mingw, too).

修改:刚刚获悉,为MSVC等效标志

Edit: Just learned that the equivalent flag for MSVC is

QMAKE_CXXFLAGS += -P

这篇关于在Qt Creator的preprocessor输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆