如何将预处理定义(宏)添加到 qt creator? [英] How to add pre processing defs (macros) to qt creator?

查看:277
本文介绍了如何将预处理定义(宏)添加到 qt creator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Eclipse 中,有一个选项可以通过使用路径和符号中的符号选项为项目指定预处理定义(#ifdef 宏).这有助于跨平台代码的有效索引.Qt Creator 中是否有提供这些选项的选项?

In Eclipse there is an option to specify pre processing defines (#ifdef macros) to a project by using the Symbols option in Paths and Symbols. This helps in effective indexing of code which is cross platform. Is there any option to provide these in Qt creator?

推荐答案

来自 QT 文档:

定义在 .config 文件中指定..config 文件是一个常规 C++ 文件,在所有源文件之前添加解析.仅使用 .config 文件添加行,如示例中所示下面:

The defines are specified in the .config file. The .config file is a regular C++ file, prepended to all your source files when they are parsed. Only use the .config file to add lines as in the example below:

#define NAME value

也就是说,如果您导入名为 MyProject 的项目,则应在 MyProject.config 中指定预处理器定义

That is, if you import a project named MyProject, then the pre-processor definitions should be specified in MyProject.config

对于我的项目,它会导致索引器在整个项目范围内识别此定义并更改自动完成以反映这一点.

For my projects it causes the indexer to recognize this define project wide and changed the auto-complete to reflect this.

这篇关于如何将预处理定义(宏)添加到 qt creator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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