Towers of Hanoi

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 8
Reputation: WrEcK is an unknown quantity at this point 
Solved Threads: 0
WrEcK WrEcK is offline Offline
Newbie Poster

Towers of Hanoi

 
0
  #1
Nov 4th, 2004
ok im trying to make the towers of hanoi program but i get the following compile error: [Linker error] undefined referrence to 'WinMain@16'

Heres the code, thanks for any help

  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. void towers (int numDisks, char source, char dest, char auxiliary)
  7. {
  8. static int step = 0;
  9.  
  10. cout << "Towers (" << numDisks << ", " << source << ", " << dest << ", " << auxiliary << ")\n";
  11. if (numDisks == 1)
  12. cout << "\t\t\t\t\tStep " << ++step << ": Move from " << source << " to " << dest << endl;
  13. else
  14. {
  15. towers (numDisks - 1, source, auxiliary, dest);
  16. cout << "\t\t\t\t\tStep " << ++step << ": Move from " << source << " to " << dest << endl;
  17. towers (numDisks - 1, auxiliary, dest, source);
  18. }
  19. return;
  20. }
Last edited by alc6379; Nov 4th, 2004 at 11:32 pm. Reason: added [code] tags
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,580
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 709
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Towers of Hanoi

 
0
  #2
Nov 4th, 2004
>undefined referrence to 'WinMain@16'
You're compiling as a Win32 application, not a console application. But either way you would get an error as you haven't defined main at all, whether it be the C++ main or the Win32 API WinMain.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC