C++ Undefined Reference to `WinMain@16'

I'm learning C++ and I came across a strange error; Everytime I want to build my project, I get "undefined reference to `WinMain@16'". Here's my code:
Main class:
1
2
3
4
5
6
7
8
#include "Kiwi.h"
#include <iostream>
using namespace std;
int main()
{
  Kiwi kiwi;
  return 0;
}

Kiwi class (.cpp):
1
2
3
4
5
6
7
#include "Kiwi.h"
#include <iostream>
using namespace std;
Kiwi::Kiwi()
{
    cout<<"Hi!";
}

Kiwi header (.h):
1
2
3
4
5
6
7
8
#ifndef KIWI_H
#define KIWI_H
class Kiwi
{
    public:
        Kiwi();
};
#endif 

If you have any idea, how to fix it, please, tell me!
Try changing the project settings to SUBSYSTEM CONSOLE if you're using Visual Studio. Your compiler thinks you're trying to create a GUI app, which takes a different version of main.
I'm actually using Code::Blocks, and I did set it to Console Application...
The solution problem is still the same...

Try this: http://forums.codeblocks.org/index.php?topic=11608.0
Last edited on
Topic archived. No new replies allowed.