找到打破了汇编中的#define [英] Locate the #define that breaks the compilation

查看:74
本文介绍了找到打破了汇编中的#define的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况的#define在头文件中的一个突破在另一头文件中枚举声明。

I am having a situation where #define in one of the header files breaks an enum declaration in another header file.

使用 -E 开关的gcc 我已经确定我有

Using -E switch on gcc I've established that I have

#define OFF 0

地方。

问题是,如何才能知道在哪里呢?该项目是巨大的​​,几十个include目录,数以百计的包含文件。我会做一个全球性的,最终的grep,但问题是,有没有办法问 GCC 编译器在哪里发生的#define?它显然有信息!

Question is, how do I find out where? The project is huge, dozens of include directories, hundreds of include files. I'll do a global grep eventually, but the question is, is there any way to ask the gcc compiler where #define occurs? It obviously has that information!

更新:感谢不是一个而是两个解决方案 - 所以来通过。
只是为了记录在案,罪魁祸首是Sybase客户端库中的一个,包括(C​​TLIB,甚至没有DBLIB)。哎哟。

Update: thanks for not one but two solutions - SO comes through. Just for the record, the culprit was one of the Sybase client libraries' includes (ctlib, not even dblib). Ouch.

推荐答案

您可以重新定义它(为不同的值)。那么GCC会告诉你它已经定义。

You can redefine it (to a different value). Then the gcc will tell you where it is already defined.

在我的系统,它看起来是这样的:

On my system it looks like this:

在文件来自以下的包括在内;某些文件>:27

In file included from < some file >:27,

             from < another file >:13: 


  
  

&LT;与重新定义的值头文件>:30:1:>警告:&lt;保证定义>重新定义

< header file with the redefined value>:30:1: > warning: "< the define >" redefined

&LT;命令行>:警告:这是previous的位置
  定义

< command-line >: warning: this is the location of the previous definition

这篇关于找到打破了汇编中的#define的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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