I need to know what this error is WinMain@16

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'|
I still need to add a array of accounts to this but I am stuck on this error code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  #include <iostream>
using namespace std;



class BankAccount
{
   private:
      int acctNum;
      double balance;
      double annualRate;
   public:
      BankAccount(int, double = 0.0, double = 0.0);
      void enterAccountData();
      void computeInterest(int);
      void displayAccount();
      double getBal();
};
BankAccount::BankAccount(int acct, double bal, double rate)
{
   acctNum = acct;
   if (acctNum < 101 || acctNum > 105 )
	{
		acctNum = 0;
	}

   balance = bal;
   annualRate = rate;
  // BankAccount (acctNum, balance, annualRate);
}
void BankAccount::enterAccountData()
{

}

void BankAccount::computeInterest(int years)
{
	int count = 0;
	double balanceint = balance;
	 while (count < years)
    {
	balanceint = (balanceint * annualRate) + balanceint;
	count++;
	cout << "After " << count << " year(s), your account balance will be $" << balanceint << endl;
	 }
}
void BankAccount::displayAccount()
{
	cout << endl;
	cout << "The principle amount in account #" << acctNum << " is: $ " << balance << endl;
	cout << " with an intrest rate of: " << annualRate << endl;
	//provide definition
}
double BankAccount::getBal()
{
     return balance;
}
I don't know why you didn't added main()

just add this to your code and it compiles (just compiles as I don't have slightest idea why you didn't add main())

1
2
3
4
int main()
{
return 0;//adding something here would be pretty useful :D :D :D
}


I think when you don't add main() you get this type of errors...
Last edited on
I couldnt tell you why... other then just over looked. I have been working on this code trying to figure out what the hell to do next... lol.. Sorry Im in C++ and This is my first week. Arrays thrown at me the 4th day...mark and now having to do a class and functions with the array... and its the 5th day of class. and I still have normal everyday job 12 hour days... Im a bit tired and still confused on how To do this...
I have to have 5 accounts along with there balances and there interest at .03% nothing was said on if its monthly or yearly...
but I have to use arrays which the first array I tried didnt work at all.
So I have gone back into the book and I have also read on here and youtube.. and Im not 100% sure still.
Im just trying to get what I know done prior to working on the nightmare of arrays.
by the way Thank you for replying ! I forgot to thank you and I looked again to see if anyone else posted and seen I didnt thank you. so A big Thank you!
"developing a BankAccount structure for Parkville Bank. Now you will develop a class that contains the fields and functions that a BankAccount needs. Create a class containing private fields that hold the account number and the account balance. Include a constant static field that holds the annual interest rate (3 percent) earned on accounts at Parkville Bank. Create three public member functions for the class, as follows:
» An enterAccountData()function that prompts the user for values for the account number and balance. Allow neither a negative account number nor one less than 1000, and do not allow a negative balance; continue to prompt the user until valid values are entered.
»A computeInterest()function that accepts an integer argument that represents the number of years the account will earn interest. The function displays the account number, then displays the ending balance of the account each year, based on the interest rate attached to the BankAccount.
» A displayAccount()function that displays the details of the BankAccount.
Create a main()function that declares an array of 10 BankAccount objects. After the first BankAccount object is entered, ask the user if he or she wants to continue. Prompt the user for BankAccount values until the user wants to quit or enters 10 BankAccount objects, whichever comes first. For each BankAccount entered, display the BankAccount details. Then prompt the user for a term with a value between 1 and 40 inclusive. Continue to prompt the user until a valid value is entered. Then pass the array of BankAccount objects, the count of valid objects in the array, and the desired term to a function that calculates and displays the values of each of the BankAccounts after the given number of years at the standard interest rate."

Topic archived. No new replies allowed.