944,120 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 10827
  • C++ RSS
Nov 4th, 2004
0

Towers of Hanoi

Expand Post »
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

C++ Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
WrEcK is offline Offline
8 posts
since Nov 2004
Nov 4th, 2004
0

Re: Towers of Hanoi

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Can someone tell me what wrong with this program it doesn't run
Next Thread in C++ Forum Timeline: Looking for _gcvt(double,int,string)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC