dim*_*mba 4 c++ eclipse compilation eclipse-cdt
这里有一个代码来演示一个恼人的问题:
class A {
public:
A():
m_b(1),
m_a(2)
{}
private:
int m_a;
int m_b;
};
Run Code Online (Sandbox Code Playgroud)
这是Console视图上的输出:
make all
Building file: ../test.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o"test.o" "../test.cpp"
../test.cpp: In constructor 'A::A()':
../test.cpp:9: warning: 'A::m_b' will be initialized after
../test.cpp:8: warning: 'int A::m_a'
../test.cpp:3: warning: when initialized here
Finished building: ../test.cpp
Run Code Online (Sandbox Code Playgroud)
问题是在Problems视图中我会看到3个单独的警告(输出中包含警告字的行),而输出中确实有4行描述了一个问题.
有什么我想念的吗?
补充问题.也许这是Eclipse精神,但有一种方法可以像大多数IDE一样使Console视图可点击(例如Visual Studio,emacs ......)
谢谢迪马
警告中有多行,因为每行引用不同的代码行.被警告是什么问题发生在m_b该声明的第9行年代,这是因为那其实m_a上线8之前声明m_b是,但它造成的发生的事情在你的初始化列表,开始第3行.
使用gcc,彼此无关的警告可能会一个接一个地出现(即,一堆无关的东西都出错main),因此Eclipse无法从输出中判断出这些是单独的警告还是所有相关的同一个问题.
| 归档时间: |
|
| 查看次数: |
3941 次 |
| 最近记录: |