That error is a
C#
compiler error but your question is tagged
C++ 14
. The compiler is saying that it cannot find a suitable entry point for the program.
In
C#
, the
Main
method must be
static
and should have one of the following signatures:
public static void Main()
public static void Main(string[] args)
public static int Main()
public static int Main(string[] args)
Your code snippet seems to be a mix of
C#
and
C++
syntax. In
C#
it should be more like this :
using System;
class Program
{
[STAThread]
public static int Main(string[] args)
{
Console.WriteLine("Hello, World!");
return 0;
}
}
If you're working with
C++
, the entry point should be
int main(int argc, char **argv)
without the
[STAThread]
attribute, which is specific to C# :
#include <iostream>
int main(int argc, char **argv)
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
M