【发布时间】:2012-05-03 23:49:51
【问题描述】:
在我之前编译良好的 VC++ 代码中,我添加了一个函数 X(),如下所示:
In the file BaseCollection.h
class Base
{
// code
virtual HRESULT X();
//code
};
IN the file DerivedCollection.h
class Derived:public Base
{
HRESULT X();
}
In the file DerivedCollection.cpp
HRESULT Derived::X
{
// definition of Derived here.
}
已在 .cpp 文件中正确包含头文件。 但我仍然不明白我收到链接错误的原因是什么:
错误 LNK2001:未解析的外部符号“公共:虚拟长 __thiscall Base::X()" (?X@Base@@UAEJI@Z)
我真的在努力修复这个错误。任何人都可以帮助我解决这个问题。 提前非常感谢。
【问题讨论】:
标签: c++ visual-c++ inheritance linker