2011-02-25 22:33:16 UTC
I'm writing a big project currently, and am getting an error from code I thought was correct. So I started a new project and wrote some very simple code, to test out some basic class functions. I am fkn getting LNK2019 errors in this tiny code!!! I've dealt with this error before, and understand that it usually involves a missing #include, or that the program is told to call a function it can't find. My brain must be completely fried, so I need someone to tell me what the hell is wrong here.
HEADER FILE
#ifndef _Account_h_
#define _Account_h_
class Account
{
private:
int number;
double balance;
public:
Account(); // Constructor
void setAccount(int,double);
};
Account::Account()
{
number = 0;
balance = 0.0;
}
#endif
CPP FILE
#include "Account.h"
#include
using namespace std;
int main(void)
{
Account acct; // create object of the Account class
int number;
double balance;
cout<<"Account: ";
cin>>number;
cout<<"Balance: ";
cin>>balance;
acct.setAccount(number,balance); // Pass values to set
}
void Account::setAccount(int num, double bal)
{
number = num;
balance = bal;
}
And that's it. Theres this simple code that performs one function, and i'm getting this error. I've went over it 200 times, and am ready to stab things.
FYI: Kudos to any of you programmers, I can't stand this crap, it makes me more angry than anything i've ever done in my life.
Oh yeah, here is the exact error message I'm receiving:
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\JamesLaptop\Documents\Visual Studio 2008\Projects\Scratch3\Debug\Scratch3.exe : fatal error LNK1120: 1 unresolved externals