This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center。
已关闭8年。
我已经看过了,而且我知道还有其他答案,但是它们似乎都没有给我我想要的东西,因此请不要将此举报为“转贴”
我的C++代码中出现无法解析的外部符号“public:__thiscall”错误,我将把它踢出窗外,并且仅使我的C++类失败。请帮我!!!!
我的支票账户头文件
及其CPP文件
我的BankAccount头文件
我的BankAccount CPP文件
我的错误:
已关闭8年。
我已经看过了,而且我知道还有其他答案,但是它们似乎都没有给我我想要的东西,因此请不要将此举报为“转贴”
我的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
我的BankAccount 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/
10-10 11:54