我正在开发一个 Visual Studio 项目 项目 A(编译时生成静态库)
有一个类(class)
using namespace mynamespace;
class projectAclass
{
virtual int funct1()=0; //Pure virtual function
virtual int funct2()=0; //Pure virtual function
virtual int funct3()=0; //Pure virtual function
};
项目B(编译时生成DLL)
#define projectBclass_DLL __declspec( dllexport )
class projectBclass_DLL projectBclass: public mynamespace::projectAclass
{
//Definitions of the 3 pure virtual functions are here
int funct1()
{
//definition go here
}
//similarly for funct2 and funct3
int funct4()
{ //Definition goes here }
int funct5()
{ //Definition goes here }
int funct6()
{ //Definition goes here }
};
现在,从其他项目中创建的主函数中,我创建了一个 projectAclass 类的对象,并尝试调用函数 funct1 但我不知道其他一些函数当我尝试调试解决方案并且从 funct4 返回后,我收到此错误
Run-Time Check Failure #0 - The value of ESP was not properly saved across a
function call. This is usually a result of calling a function declared with
one calling convention with a function pointer declared with a different calling
convention.
提前致谢
最佳答案
有时您有 calling conventions错误的。有时重建一切就能解决问题。
关于c++ - 函数调用期间未正确保存 ESP 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17446089/