2013-07-01 69 views
0

Visual Studio Ultimate 2012 - 入口點必須定義。VSU 2012 - 入口點必須定義

你好。我有文件:

MyForm.h

Forma.h

MyForm.cpp

在Myform.cpp我有

#include "MyForm.h" 

using namespace std; 
using namespace System; 
using namespace System::Windows::Forms; 
void main(array<String^>^args){ 
Application::EnableVisualStyles(); 
Application::SetCompatibleTextRenderingDefault(false); 
Project1::MyForm form; 
Application::Run(%form);  
} 

但是當我嘗試RELASE它,我有錯誤:

Error 2 error LNK1561: entry point must be defined

+0

你在任何地方都有主要功能嗎? – Borgleader

+0

這是C++/CLI(.NET運行時),不是本機C++代碼。您是否在啓用了Common Runtime Support開關的情況下進行編譯? – Cameron

+3

嗯......'void main(array ^args)'。 –

回答

5

答案我相信您的問題分兩步進行:

  1. 按右鍵點擊您的項目文件,選擇 「屬性」, 「鏈接」, 「系統」, 「子系統」=的Windows enter image description here

  2. 而且還 「接頭」, 「高級」,「入境點「並鍵入」主「... M:大寫。

    enter image description here

按ctrl + F5測試。一旦一切都結束,您可以設計正常的表單。

**注:**這是一個那麼直接暗示,他們希望你停止創造C++/CLI的WinForms應用。但是管道仍然存在,至少對於VS2012和VS2013來說。未來的情況可能並非如此。

0
#include "MyForm.h" 
#include <Windows.h> 

using namespace System; 
using namespace System::Windows::Forms; 
using namespace testing; 
//go to MyForm.h and look for [namespace ****] where **** is the name of your project..mines name is testing. :) 


STAThreadAttribute; 
void main(){ 
    Application::EnableVisualStyles(); 
    Application::SetCompatibleTextRenderingDefault(false); 
    Application::Run(gcnew MyForm()); 
} 
相關問題