现在的位置: 首页 > 综合 > 正文

c++ 前置声明不能随便用 会引起类型不完全的错误

2013年10月28日 ⁄ 综合 ⁄ 共 198字 ⁄ 字号 评论关闭

as:

   XX.h

    namespace WebCore{

 class String

class A{

String test() const;

};

}

XX.cpp

namespace WebCore{

String A::test()const

{}

}

在XX.cpp的test函数就容易引起返回类型不完全错误

根本的原因就是String 不是在WebCore空间定义的,是在webkit中的WTF空间中

这一点还是要引起注意

抱歉!评论已关闭.