Re: /target is 'exe' but no suitable main method was found in compilation
From: Alex K. Angelopoulos [MVP] (aka-at-mvps-dot-org)
Date: 06/07/04
- Previous message: Mary: "Re: Please thiHelp"
- In reply to: Mary: "/target is 'exe' but no suitable main method was found in compilation"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Jun 2004 13:40:36 -0500
Mary wrote:
> Can someone tell me what this error means in J# /target is 'exe' but
> no suitable main method was found in compilation
Console executables (which are compiled with the commandline parameter
/target:exe) need to have an entry point function declared, usually done as
follows:
public static void main(String[] args)
{
// code that calls stuff goes here
}
Most likely one of the following is your problem:
+ Your main is not declared as public static void or is missing
+ The compiler can't find the main entry point due to having multiple
classes; in that case:
- If using the commandline compiler you need to also use the option
/main:<class> where <class> is the name of the class containing your desired
entry point function;
- If using the Visual Studio IDE, go to the Project menu and choose the
<projectname> Properties item from the bottom of the menu; under General
enter the name of the class containing the entry point.
+ You accidentally set the target type incorrectly - /target:exe is only for
console executables. If you meant to have a different type of project:
- if using the commandline compiler, use the appropriate argument instead:
/target:winexe, /target:library, or /target:module;
- if using VS, in the project properties under General change Output Type to
the correct type.
- Previous message: Mary: "Re: Please thiHelp"
- In reply to: Mary: "/target is 'exe' but no suitable main method was found in compilation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|