C++ various errors while using classes -.-
Hello, I wrote a small program using classes, but im getting stupid errors and i cant figure out why.
This is the main file, which calls upon my classes functions the errors in this file are
error LNK2019: unresolved external symbol "public: void __thiscall account::getBalance(void)" (?getBalance@account@@QAEXXZ) referenced in function _main
error LNK2019: unresolved external symbol "public: __thiscall account::account(int)" (??0account@@QAE@H@Z) referenced in function _main
fatal error LNK1120: 2 unresolved externals
Code:
// TestAccount.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include "account.h"
using namespace std;
int main() {
account acc (100);
acc.getBalance() ;
return 0;
}
This is the header file... no errors here
Code:
#include <iostream>
#include <string>
class account{
public:
account(int init) ;
void accountSetBalance (int init);
void accountCredit (int deposit);
void accountDebit ( int withdraw);
void getBalance ();
private:
int balance;
};
This is the file with all the functions and such, no errors here
Code:
#include "stdafx.h"
#include <iostream>
#include <string>
#include "account.h"
using namespace std;
account::account(int init){
accountSetBalance ( init) ;
}
void account::accountSetBalance (int init){
if (init >=0) {
balance = init ;
cout << "Your account has a balance of $" << balance << endl;
}
if (init <0) {
balance = 0 ;
cout << " Negative or Invalid Balance, Balance set to Zero " << endl;
}
}
void account::accountCredit (int deposit){
if (deposit>0){
cout << "Invalid deposit" << endl;
}
if(deposit<0){
balance = balance+ deposit ;
cout << "Your total balance is now $" << balance << endl ;
}
}
void account::accountDebit ( int withdraw) {
if (balance-withdraw>0) {
cout << "Not enough money, amount invalid" << endl ;
accountDisplay() ;
}
if (balance-withdraw<=0){
balance=balance-withdraw;
accountDisplay() ;
}
}
void account::getBalance () {
cout << "You have a balance of $" << balance << endl;
}
Okay, so after looking at the error, I can guess that it has something to do with my class not being found or something of the sort.
Im using msvs 2010, and when i use the class viewer I can see all the different functions, but for some reason, it looks as if the compiler is not connecting my calls to the header file, or the header file to the functions...
Can anyone tell me what i did wrong?