class function "unknown symbol"

Afternoon, C++.com!! I'm hoping you can help me with something that I'm sure is really simple. I'm writing my first class function and so far it's compiling and seems like it should work, but when I run it I'm getting the error:

"ZeroLink: unknown symbol '__ZN15CheckingAccountC1Ev'

assign 5 has exited due to signal 6 (SIGABRT)."

I have another program almost exactly like it which is running fine. Any help would be greatly appreciated!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class CheckingAccount 
{ 
public: 
  //constructors  
  CheckingAccount(string full_name, double balance); 
  CheckingAccount(); 
  void input(); 
 
  // accessors 
  double get_balance(); 
  string get_name(); 
  void make_deposit(); 
  void make_withdrawal(); 
 
private: 
  string full_name; // account holders full name 
  double balance; // balance of the account 
}; 

1
2
3
4
5
6
7
8
9
int main()
{ 
	cout << "Welcome to the CS240A Bank! We must first set up your account.\n";
	CheckingAccount account1;
	account1.input();
	cout << "Your name is" << account1.get_name() << endl;
	cout << "\nThe initial balance is $" << account1.get_balance() << endl;
return();
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void CheckingAccount::input()
{
	cout << "Please enter your name: ";
	cin >> full_name;
	cout << endl << "Please enter the current balance of your checking account: ";
	cin >> balance;
	cout << endl;
}

double CheckingAccount::get_balance()
{
	return(balance);
}

string CheckingAccount::get_name()
{
	return(full_name);
}



Thanks again for any help!
It may matter that I seem to be having problems with the string declaration...a string *can* be used in a class, correct? I'm using Xcode, if that makes any difference.

Thanks again for any help!
The only thing that jumps out at me is this:

1
2
3
4
5
int main()
{ 
//...
return();  // <-
}


Try actually returning something. IE: return 0;
That didn't make any difference :/

Am I calling the different parts of the class correctly, do you know? Why would it compile and then give me a weird error like that?

I really have no idea how to progress with this :(
Well I just tried compiling this and I got an error because you never gave your ctors a body:

1
2
3
  //constructors  
  CheckingAccount(string full_name, double balance); 
  CheckingAccount();   // specifically this one 


After giving that ctor an empty body it compiled and ran fine for me.
Disch, thank you so much! I never would have thought to add an empty body, but now it makes so much sense ^^.

Have a great evening!
it's weird that it was compiling for you. It really shouldn't have been. You should've got a linker error.
Topic archived. No new replies allowed.