c++(构造函数)LNK 2019错误
c++ (constructor) LNK 2019 error
可能的重复:
什么是未定义的引用/未解决的外部符号错误,如何修复?
我有一个LNK错误,它涉及一个类a及其派生类B。更准确地说,我有这个编译错误
Error 239 error LNK2019: unresolved external symbol "public: virtual __thiscall A::~A(void)" (??1A@@UAE@XZ) referenced in function "public: virtual __thiscall B::~B(void)" (??1B@@UAE@XZ) D:Productspathfile.lib(B.obj)
Error 240 error LNK2019: unresolved external symbol "public: __thiscall A::A(void)" (??A@@QAE@XZ) referenced in function "public: __thiscall B::B(void)" (??B@@QAE@XZ) D:Productspathfile.lib(B.obj)
Error 241 error LNK2019: unresolved external symbol "public: void __thiscall A::function(float * *,float * *,float * *,float * *,int)" (?function@A@@QAEXPAPAM000H@Z) referenced in function "public: class SomeType* __thiscall B::function_bis(void)" (?function_bis@B@@QAEPAVSomeType@@XZ) D:Productspathfile.lib(B.obj)
我想这可能与继承构造函数的调用有关,或者与函数()或函数比斯()的某些调用中不尊重签名有关。然而,我找不到这样的错误。
你有一个可能的解决方法的提示吗?这是(简化的)A和B的代码。
B.cpp
B::B(void)
{
}
B::B(Type1* d1, Type1* d2, Type1* r):A()
{
D1= d1;
D2= d2;
R= r;
}
B::~B( void )
{
}
SomeType* B::function()
{
// do things
function_bis() ;
}
B.h
class B:
public A
{
public:
B(void) ;
B(Type1* , Type1* , Type1* );
virtual ~B(void);
SomeType* function() ;
private:
Type1* D1;
Type1* D2;
Type1* R;
};
A.cpp
using namespace std ;
A::A(void){}
A::~A(void){}
void A::function_bis(float** d, float** d2, float** d3, float** d4, int n)
{}
A.h
class A
{
public:
A(void);
virtual ~A(void);
void function_bis(float** , float** , float** , float** , int );
};
谢谢!
代码中的所有内容看起来都是合法的。
我的猜测是,你实际上没有编译A.cpp,或者不知何故,你没有在链接步骤中包括生成的对象文件(你错过了A.cpp中定义的A::A、A::~A和A::function_bis)
相关文章:
- 将QT项目导入Visual Studio 2019会给我带来很多LNK2001错误
- Visual Studio 2019在内置库中存在错误
- 编译器错误(英特尔并行工作室 2019 与 Visual Studio 社区 2019)
- 错误C++在Visual Studio 2019中使用numeric_limits的长双精度最小值/最大值
- 在我的以下代码中获取 MLE(内存限制错误).尝试解决 ROUND C 2019(问题 A-摆动行走)启动问题
- Microsoft Visual Studio 2019交叉编译CMake库 - 有效,但存在SEG错误
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- 在Windows 10上使用Visual Studio 2019的Boost 1.71.0库出现错误
- 在Visual Code 2019中使用graphics.h绘制线条时,如何修复错误E0167和C2019?
- Visual Studio 中的 lcr 游戏 c++ LINK 2019 错误
- VS-2019 的编译错误
- C++ 链接器错误 LNK 2019 函数中引用的未解析的外部符号
- Visual Studio 2019 不会打开包含源文件的窗口,也不会定位为出现错误的行
- 在Visual Studio 2019中构建简单的点云可视化代码时,来自PCL的第三方库的多个错误
- Linker错误2019使用Windows上使用Shogun DLL
- 在Visual Studio 2013中编译的STL列表代码在Visual Studio 2019中给出了错误.想知道原
- c++(构造函数)LNK 2019错误
- 使用 C++ 在 directX 11 中的 VS 2013 中获取 LNK 2019 错误
- C++ - LNK 2019 错误,尝试定义子类静态函数
- 链接2019错误,但定义存在