![]() |
Error CS5001 while compiling, i have no idea!
Hello,
I am new to C# so please dont reply using confusing language, i have made a program but everytime i debug i get 1 error saying: Build started. Compiling IconEditor error CS5001: Program 'c:\Documents and Settings\Tony\My Documents\SallyIDE C#\Sally IDE Source Code\IconEditor\obj\Debug\TestProject.exe' does not contain a static 'Main' method suitable for an entry point Build failed. Now, the area where i believe code is is here: public class MyApplication { public static MainForm MyMainForm=null; private static string moduleDir=""; [STAThread] public static void Main(string[] args) { Application.EnableVisualStyles(); Application.DoEvents(); moduleDir=Path.GetDirectoryName(Application.ExecutablePath); MyMainForm=new MainForm(); if (args.Length>0) { string ext=Path.GetExtension(args[0]).ToLower(); if (ext==Globals.ProjectExtension) MyMainForm.LoadProject(args[0]); else if (ext==Globals.SolutionExtension) MyMainForm.LoadSolution(args[0]); } Application.Run(MyMainForm); } public static string ModuleDir { get { return moduleDir; } } } I dont know how to fix it i just need some help, if you need anymore code, or if you could be really nice and take my source and fix it, that would be great, just message me. Thanks:banana: |
Please read the forum's rules/FAQ, particularly with regard to the use of code tags. It's the polite thing to do when you join a community to ask for help.
|
>>>Application.Run(MyMainForm);
try entering new before MyMainForm: Application.Run(new MyMainForm()); |
That's not it, Samuaijack. MyMainForm is an reference to an object, rather than a class.
It would help if the author used code tags, but I don't see anything wrong with the program itself. I suspect something is wrong with the configuration of aff1993's IDE. My advice would be to try and first get a simple Hello World console program compiling, and then move on from there. |
There a reason you have a space (Execut ablePath) in this line?
moduleDir=Path.GetDirectoryName(Application.Execut ablePath); Or is that just how it posted in for some reason? |
Probably how it was posted. The forum software splits up continuous sequences of characters longer than 50 characters. Also, the error raised by the compiler doesn't appear to indicate a syntax error.
|
Thnx Arevos, it was just something that caught my attention off hand... odd how the forum software does that. :|
|
I think its to stop the page streching.
Maybe it doesn't split words up in code tags. |
Quote:
moduleDir=Path.GetDirectoryName(Application.ExecutablePath); (So we'd know if the OP put the space in or not. I took the space out before posting.) |
This should run, it will pop up a window, and print out the application path on the command line.
I wasn't sure what the codes that I commented were suppose to do... :
using System; |
| All times are GMT -5. The time now is 1:11 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC