0

I was looking for the .exe of my program and I couldn't find any in the release folder, so I decided to explicitly compile release. But here's what I get every time I attempt to compile: e:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to 'WinMain@16'|

From googling around it looks like it's a linker error, but how the heck can I take care of it?

My program consists of main.cpp and the following includes: (It's a console application)

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <fstream>
#include <sstream>
#include "AVLTree_GeeksforGeeks.h" //Consists of an extra .cpp
#include <vector>
#include <memory>
#include <limits>

int main()
{
    /*
    code
    */
    return 0;
}

I'm a bit tired as it's 1am here and I'm trying to get some ideas on what might be wrong. Should I just try compiling from console?

Dimitris Sfounis
  • 2,400
  • 4
  • 31
  • 46

1 Answers1

0

You are building a GUI subsystem app. That can be discerned by the fact that the linker is looking for a main function named WinMain. Change your compilation options to target the console subsystem.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490