fatal error: entry point must be defined
Mark Oates

I'm using MSVC 10, and trying to create a separate library that contains main() while the actual project program contains other functions. And I get that error "fatal error: entry point must be defined." Which I understand is because there is no main() in the project. I tried putting extern void main() into the project, but no success. I have 4 files:

The Lib


extern void function1();
extern void function2();

extern void main();


#include "framework.h"

void main()

The Program


#include "../framework/framework.h"

#include <iostream>

void function1()
  std::cout << "Hello World";
void function2()

What's the best way to do this?

[edit:] Hrmkay, it appears that switching to the "Console (/SUBSYSTEM:CONSOLE)" has allowed the program to compile and run. I'm not sure why. This is under Program Properties > Configuration Properties > Linker > System > Subsystem.
It was previously blank.


Maybe it was looking for WinMain before? :-/ It seems pretty strange to put main in a library. :)

Trent Gamblin

main should always return int, not void, but what bamccaig said is right. Windows applications look for WinMain not main. You might be surprised if you're used to using Allegro because it does some magic to hide that from you :).

Thread #605228. Printed from Allegro.cc