0

I have a really simple shell of of a program. The editor i use is Scite and my compiler is MingW.

The answer to this is that I'm missing a main but i do have a main().

Main.cpp

#include <iostream>
#include "Money.h"

using namespace std;

int main()
{


}

Money.cpp

#include "Money.h"
#include <iostream>


using namespace std;

Money::Money()
{
    cout << "test"

}

Money.h

#ifndef MONEY_H 
#define MONEY_H

class Money 
{
   public:
      Money();
   private:

};

 #endif //MONEY_H

Everytime I try to compile Money.cpp it gives me the error

libmingw32.a(main.o):(.text.startup+0xa7): undefined reference to `WinMain@16'

And I'm not sure what's wrong with the program. All the files are in the same directory. I'm fairly new to programming in C++ so if you can give me a very basic answer or fix it be greatly appreciated.

user3249265
  • 113
  • 1
  • 5
  • 16

1 Answers1

0

WinMain is the entry point of Windows "Win32" programs.

You are probably using Visual Studio wizard to create your C++ project, but you chose a Windows C++ application. Such an application is expected to have WinMain() as an entry point (the @16 part is name mangling decorations, according to Visual C++ compiler rules), but you haven't provided that in your code.

If you want to build a C++ console-mode application (with the classical standard main() entry point), you may want to choose the Win32 Console Application option when creating a new project with Visual Studio.

E.g. this is a screenshot from Visual Studio 2010:

Win32 Console Application option for new project in Visual Studio 2010

Mr.C64
  • 41,637
  • 14
  • 86
  • 162