1. Set Linker/Advanced/Entry Point to "" (empty string)
2. Set Linker/System/Subsystem to Not Set
Step 1: Makes sure that the CRT startup code is invoked. This is because, if no entry point is specified, the linker will automatically use mainCRTStartup, which is defined in the CRT libraries. mainCRTStartup will make sure that the global object is initialized correctly.
Step 2: Makes sure that the linker will look for the symbol “main”. The linker looks for “main” because mainCRTStartup calls main() in its body. The default option for a Winforms application is Subsystem:Windows and this makes the linker look for WinMain().
Thanks
Sarita Bafna
Visual C++ team
测试程序:
// N3CLR.cpp : main project file.
#include "stdafx.h"
#include "MainForm.h"
#include "stdneb.h"
#include "core/coreserver.h"
#include "io/ioserver.h"
using namespace N3CLR;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created