我是编程新手,我是一名机械工程师。有没有人可以教我如何调试控制台应用程序
例如:
当我调试一个程序时,它给出了以下错误:(Rep是我的文件名)
Rep.exe doesn't contain a Static 'Main' Method suitable for an entry point发布于 2014-03-13 19:46:44
显示您的代码。main应该有一个String[]参数,它是静态的,并且不返回任何内容。可能是公共的也可能是内部的(但我不确定这一点)。
如下所示:
class Program {
public static void Main(string[] args) {
//... your code....
}
}发布于 2014-03-13 19:47:28
如果您来自ConsoleApplication,则添加一个名为Program的类,如下所示
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace YourNameSpace //<-------------------
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new YourForm()); //<----------------------
}
}
}我认为这将解决您的问题:)
亚瑟
发布于 2014-03-13 19:45:17
你需要在你的类中创建一个静态的Main方法。如下所示:http://msdn.microsoft.com/en-us/library/acy3edy3.aspx
https://stackoverflow.com/questions/22377530
复制相似问题