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;
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.