0

I'm not entirely sure why i'm suddenly getting this error, as i wasn't in December.

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

error i'm getting http://gyazo.com/f0467badccaca7ef270ea02c2b8f595f.png

The ide im using is code blocks

I have made sure it is a console application, and none of the other questions asked have helped.

  • 1
    You're probably not compiling that file for whatever reason. The console application part is not necessary in the slightest, despite what the error might lead you to believe. – chris Feb 22 '14 at 16:42
  • 3
    You are compiling your code as a "windows application" rather than as a "console application". Change your settings in whatever IDE/tool you are using to build your code, so that it's trying to build a "console application". – Mats Petersson Feb 22 '14 at 16:42
  • @MatsPetersson, See http://stackoverflow.com/questions/5259714/undefined-reference-to-winmain16?rq=1. In addition, I've done `int main()` with a Windows subsystem many times in CodeBlocks (or GCC in general) with no problems. – chris Feb 22 '14 at 16:43
  • Many things have changed since December... – valdo Feb 22 '14 at 16:43
  • `I have made sure it is a console application` Sorry, you haven't! – Lightness Races in Orbit Feb 22 '14 at 16:44
  • I am compiling it as a console application, and i haven't updated anything since December, so i don't see how anything could have changed for me. Also, i'm using code blocks, as i mentioned in the question. – whatsGravity Feb 22 '14 at 16:45
  • http://gyazo.com/c67520c41028fc661d6f2e3f84835829 – whatsGravity Feb 22 '14 at 16:49
  • well, then you have either "done it wrong", or your compiler (or more accurately) linker isn't listening. `WinMain16` is the entry point for a Windows (non-console) application. You don't have one, because you are writing a console application. You can insist on this being "the wrong answer", but the problem is definitely caused by the linker not finding the `main` of your application, because it's looking for the "wrong kind" of `main`. – Mats Petersson Feb 22 '14 at 17:02
  • I'm going to try to reinstall MinGW then, as i cant understand why its doing this. – whatsGravity Feb 22 '14 at 17:15
  • @MatsPetersson, I can assure you it gives the same error with a console application that's missing a `main` function altogether and fixes itself if you add in `int main() {}`. – chris Feb 22 '14 at 17:20
  • Well i'm getting a different error now... – whatsGravity Feb 22 '14 at 17:36

0 Answers0