- Online Community Forums » Programming Questions » fatal error: entry point must be defined

This thread is locked; no one can reply to it. rss feed Print
fatal error: entry point must be defined
Mark Oates
Member #1,146
March 2001

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.

Member #7,536
July 2006

Trent Gamblin
Member #261
April 2000

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 :).

Go to: