gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 18:42:39 28 4
gpt4 key购买 nike

<分区>

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

我在我的 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)

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com