在VS2013中創建CLR空項目;在點擊“項目”創建“Windows 窗體”;完成MyForm設計后,按F5運行跳出錯誤“必須定義入口點”。
解決方案:
在MyForm.cpp中,添加如下代碼:
1 using namespace Project1; 2 3 [STAThreadAttribute] 4 int main(array<System::String ^> ^args) 5 { 6 Application::EnableVisualStyles(); 7 Application::SetCompatibleTextRenderingDefault(false); 8 9 Application::Run(gcnew MyForm()); 10 11 return 0; 12 }
那么問題就解決了。