c++ - 未解析的外部符号“公共(public) : __thiscall

标签 c++

<分区>

我看过,我知道还有其他答案,但似乎没有一个能给我我正在寻找的东西,所以请不要将此报告为“转贴”

我在我的 C++ 代码中收到未解析的外部符号“public: __thiscall”错误,我正要把它踢出窗外,让我的 C++ 类不及格。请帮助我!!!!

我的支票账户头文件

#include "BankAccount.h"
class CheckingAccount
{
private:
int numOfWithdrawls;
double serviceFee;
int AccountBal;

public:
bool withdraw (double wAmmt);
BankAccount CA;
CheckingAccount();
CheckingAccount(int accountNum);
};

及其CPP文件

#include <iostream>
using namespace std;
#include "CheckingAccount.h"

CheckingAccount::CheckingAccount()
{
CA;
numOfWithdrawls = 0;
serviceFee = .50;
}
CheckingAccount::CheckingAccount(int accountNum)
{
CA.setAcctNum (accountNum);
numOfWithdrawls = 0;
serviceFee = .50;
}
bool CheckingAccount::withdraw (double wAmmt)
{
numOfWithdrawls++;
if (numOfWithdrawls < 3)
{
    CA.withdraw(wAmmt);
}
else
{
    if (CA.getAcctBal() + .50 <=0)
    {
        return 0;
    }
    else
    {
        CA.withdraw(wAmmt + .50);
        return 1;
    }
}
}

我的 BankAccount 头文件

#ifndef BankAccount_h
#define BankAccount_h
class BankAccount
{
private:
int acctNum;
double acctBal;

public:
BankAccount();
BankAccount(int AccountNumber);
bool setAcctNum(int aNum);
int getAcctNum();
double getAcctBal();
bool deposit(double dAmmt);
bool withdraw(double wAmmt);
};
#endif

我的银行账户 CPP 文件

#include <iostream>
using namespace std;
#include "BankAccount.h"

BankAccount::BankAccount(int AccoutNumber)
{
acctNum = 00000;
acctBal = 100.00;
}
bool BankAccount::setAcctNum(int aNum)
{
acctNum = aNum;
return true;
}

int BankAccount::getAcctNum()
{
return acctNum;
}

double BankAccount::getAcctBal()
{
return acctBal;
}

bool BankAccount::deposit(double dAmmt)
{
acctBal += dAmmt;
return true;
}

bool BankAccount::withdraw(double wAmmt)
{
if (acctBal - wAmmt <0)
{
    return 0;
}
else
{
    acctBal -= wAmmt;
    return 1;
}
}

我的错误:

1>BankAccountMain.obj : error LNK2019: unresolved external symbol "public: __thiscall BankAccount::BankAccount(void)" (??0BankAccount@@QAE@XZ) referenced in function "public: __thiscall SavingsAccount::SavingsAccount(void)" (??0SavingsAccount@@QAE@XZ)

1>CheckingAccount.obj : error LNK2001: unresolved external symbol "public: __thiscall BankAccount::BankAccount(void)" (??0BankAccount@@QAE@XZ)

最佳答案

“__thiscall”是噪音。继续阅读。错误消息提示 BankAccount::BankAccount(void)。头文件说 BankAccount 有一个默认的构造函数,但没有它的定义。

关于c++ - 未解析的外部符号“公共(public) : __thiscall,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12184027/

相关文章:

c++ gluLookAt的OpenGL显示问题

c++ - COLORREF 和 D2D1::ColorF 之间的转换

c++ - 使用dumpbin查看C++库信息时,UNDEF和notype()是什么意思?

C++:非类型化函数指针

c++ - O(N) 中的锦标赛获胜者和 O(NLogN) 中的玩家排名

c++ - 如何从 openGL 屏幕写入 PNG 文件?

c++ - 我怎样才能用静态变量(C++)干掉这些函数?

c++ - std::tie 的异常安全性如何?

c++ - Visual Studio 中的 QRC 资源文件

c++ - EnableMenuItem 函数无法使用参数 MF_GRAYED