shuididishui007 2014-12-04 16:31 采纳率: 0%
浏览 2301

在Bulid 时出错 ,Error executing link.exe.

小白,敲课本的代码,出现错误,这是我第一次出现这样的错误,根本无从下手,请教大神出手相救。。。
--------------------Configuration: 具有构造函数的类1 - Win32 Debug--------------------
Linking...
具有构造函数的类1.obj : error LNK2001: unresolved external symbol "public: void __thiscall BankAccout::output(class std::basic_ostream > &)" (?output@BankAccout@@QAEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@
@Z)
Debug/具有构造函数的类1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

具有构造函数的类1.exe - 2 error(s), 0 warning(s)

//该程序用于演示BackAccount 类
#include
using namespace std;

//定义银行账户的类
class BankAccout
{
public:
BankAccout(int dollars , int cents , double rate );
//将账户余额初始化为¥dollars.cents 将利率初始化为利率百分比

BankAccout(int dollars ,double rate);
//将账户余额初始化为¥dollars.00 将利率初始化为利率百分比

BankAccout();//默认构造函数
//将账户余额初始化为0.00 将利率初始化为0.0%

void update();
//后条件:将1年的单利添加到账户余额上

//将当前账户利率作为一个百分比返回
double get_rate ();

//返回当前账户余额
double get_balance();

void output (ostream &outs);

private:
double balance ;
double interest_rate ;

//将百分比转换成小数
double fraction(double percent);

};
int main ()
{
BankAccout account1(100 , 2.3) , account2 ;
cout <<"account1 initialized as follows :\n";
account1.output(cout);
cout << "account2 initialized as follows : \n" ;
account2.output(cout);

//对构造函数BankAccount::BankAccount 的显示调用
account1 = BankAccout(999 , 99 , 5.5);
cout << "account1 reset to the following :\n";
account1.output(cout);
return 0 ;

}
//将账户余额初始化为&dallors.00将利率初始化为利率百分比
BankAccout::BankAccout(int dollars ,int cents , double rate)
{
if ((dollars < 0 ) ||(cents < 0 ))
{
cout <<"Illegal values for money or interest rate .\n";
exit(1);
}
balance = dollars + 0.01 * cents;
interest_rate = rate ;
}
//将账户余额初始化为&dallors.00 将利率初始化为利率百分比
BankAccout::BankAccout(int dollars , double rate )
{
if ((dollars < 0 ) || (rate < 0 ))
{
cout <<"Illegal values for money or interest rate .\n";
exit(1);
}
balance = dollars ;
interest_rate = rate ;
}
BankAccout::BankAccout():balance(0) , interest_rate(0.0)
{
//主体有意留空
}

  • 写回答

2条回答 默认 最新

  • threenewbee 2014-12-04 17:14
    关注

    void output (ostream &outs);这个函数光定义了,它的实现在哪里?

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置