English 中文(简体)
2. 列出打破汇编的标准
原标题:Locate the #define that breaks the compilation
  • 时间:2011-10-28 20:42:48
  •  标签:
  • c++
  • c
  • gcc

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

使用<条码>-E 交换<条码> 我确定,我已经

#define OFF 0

某些地方。

问题在于,我是如何找到的? 该项目是巨大的,有数十个目录,数百个包括档案。 我最终做过一次全球磨擦,但问题是,有没有办法要求<条码>gcc/<>。 • 编造什么地方? 它显然拥有这一信息!

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.

最佳回答

你们可以重新界定(价值不同)。 然后,电梯将告诉你它已经界定了什么。

在我的制度上,它希望:

In file included from < some file >27,

             from < another file >:13: 

< Header file with the definedd Value>:30:1: > press: “< the definition >”

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

问题回答

Use the option -dD together with -E. With both enabled you see the preprocessing result including the defines. Just look for you macro (like #define OFF 1) and scroll up, to the # number filename, and you find the last include file, so it was the one, that defined your macro.

一种很好的解决办法是管理像“标签”这样的东西,因为“标签”基本建立了你法典界定的象征数据库。 之后,许多普通编辑(vim, emacs)将读到标签档案中,让你迅速按姓名跃入定义。 例如,使用正文一就简单:

:ta myfunction

To find the definition of myfunction. This works equally well for macros created with #define, and it supports a variety of languages other than C. I m using exhuberant ctags, which is what you get if you install ctags on a RHEL-ish system, but it s certainly available under Debian, Ubuntu, OS X, and so forth.





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签