0
请帮我理解gcc编译器的输出。我完全困惑。错误:声明'<...>'。奇怪的编译错误
我有一个错误:
C/types.h:47:56: error: declaration of
'struct VV::MM<VV::SSS::Vector<short unsigned int>, 8u, 0u>'
这已经有些陌生。
在types.h中:47我看到:
template<typename V, size_t Size1, size_t Size2> class MM;
这是看起来不错我。
这是构建日志中的第二个错误消息,我不知道它可能只是第一个错误的第二部分?这里第一和第二误差在一起:
<... compiles normally, no errors ...>
In file included from A/T.h:14:0,
from B/I.h:5,
from B/F.cxx:54:
A/AArray.h: In instantiation of
'AInternal::AlignedData<VV::MM<VV::SSS::Vector<short unsigned int>, 8u, 0u>, 104u, 0>':
A/AArray.h:561:125: instantiated from
'AFArray<VV::MM<VV::SSS::Vector<short unsigned int>, 8u, 0u>, AArraySize<104u> >'
A/V.h:73:99: instantiated from here
A/AArray.h:364:20: error: 'AInternal::AlignedData<T, Size, 0>::fArray'
has incomplete type
C/types.h:47:56: error: declaration of
'struct VV::MM<VV::SSS::Vector<short unsigned int>, 8u, 0u>'
In file included from <...other errors...>
在A/VH:73我有:
AFArray<VV::SSS::Vector<short unsigned int>::MM, AAArraySize<N> > fAlpha;
,我相信可以触发在日志中第二行:
A/AArray.h: In instantiation of
'AInternal::AlignedData<VV::MM<VV::SSS::Vector<short unsigned int>, 8u, 0u>, 104u, 0>':
因为由于第二个错误,VV :: SSS :: Vector :: MM是未定义的类型。
所以我有2个问题:
- 是第二个错误消息的第一个错误的一部分吗?
- 这个声明有什么问题?
将types.h中的所有环绕代码行粘贴到您的问题中(具体来说,紧接在types.h的第47行左右的半打左右的行中,包括该行)。 – WhozCraig
自上而下阅读错误消息。分别修复它们中的每一个。在编译器遇到错误后,它会尝试尽可能恢复和继续,但语言是上下文敏感的,并且可能无法正确恢复,因此需要用少许盐来获取第二个和更多错误消息。 –
在gcc中,第一个错误块从第一个'从文件包含的文件'到第二个'包含文件的文件'。在这个块中,第一次出现'error:'或'warning:'是编译器抱怨的地方。在它上面,你会发现为什么gcc甚至在看那个文件,它在做什么(它正在编译的函数,或者你的情况下是哪个模板被实例化),接下来是为什么它需要这样做。在'error:'之下,根据具体情况可能会有所帮助。什么函数定义是可用的('note:'),可能是为什么它们不适合('error:')。 – mars