0

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

#include <iostream>
#include <cstdlib>

using namespace std;

void towers (int numDisks, char source, char dest, char auxiliary)
{
    static int step = 0;

    cout << "Towers (" << numDisks << ", " << source << ", " << dest << ", " << auxiliary << ")\n";
        if (numDisks == 1)
                cout << "\t\t\t\t\tStep " << ++step << ": Move from " << source << " to " << dest << endl;
        else 
           {
            towers (numDisks - 1, source, auxiliary, dest);
             cout << "\t\t\t\t\tStep " << ++step << ": Move from " << source << " to " << dest << endl;
             towers (numDisks - 1, auxiliary, dest, source);
            } 
        return;
}
2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by Narue
0

>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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.