Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/153.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 无法解决错误:链接器命令失败,退出代码为1_C++_Xcode - Fatal编程技术网

C++ 无法解决错误:链接器命令失败,退出代码为1

C++ 无法解决错误:链接器命令失败,退出代码为1,c++,xcode,C++,Xcode,试图创建一个类帐户,但每次生成时都会收到“linker命令失败,退出代码为1”。任何建议都将不胜感激,因为我已经尝试解决这个问题好几天了 #include <iostream> using namespace std; class Account { public: Account(); Account(double input_balance); void input(); private: double balance; }; Account::Account() {

试图创建一个类帐户,但每次生成时都会收到“linker命令失败,退出代码为1”。任何建议都将不胜感激,因为我已经尝试解决这个问题好几天了

#include <iostream>
using namespace std;

class Account
{
public:
Account();
Account(double input_balance);

void input();
private:
double balance;
};


Account::Account()
{   
double balance = 0.0;
}
Account::Account(double input_balance)
{
double balance = input_balance;
}

void Account::input()
{
char in;
    cout << "Would you like to deposit or withdraw money from your account?    Enter D for deposit and W for withdraw: ";
cin >> in;

if(in == 'd' || in == 'D')
    cout << "Yo";
if(in == 'w' || in == 'W')
    cout << "no";
}

int main()
{
Account tyler;
tyler.input();
}
#包括
使用名称空间std;
类别帐户
{
公众:
账户();
账户(双重输入余额);
无效输入();
私人:
双平衡;
};
Account::Account()
{   
双平衡=0.0;
}
账户::账户(双输入_余额)
{
双平衡=输入平衡;
}
无效帐户::输入()
{
炭素;
cout>in;
if(in='d'| in='d')

cout
double balance=0.0;
Account::Account()
中的
不会初始化成员变量,这会声明一个新的局部变量并将其初始化为
0.0
(您在另一个构造函数中犯了相同的错误)这是完全错误吗?