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);这个函数光定义了,它的实现在哪里?

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?