'function cannot be overloaded"

void WinMain() {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
RoExplorerV2::MyForm mainForm;
Application::Run(%mainForm);
}

With the above code, I get the error code C2731 described as 'WinMain': function cannot be overloaded. How can I get around this? There is no parameter so I don't understand what's going on. Your help is appreciated.
WinMain() has already been declared in headers you've no doubt included (code not shown). If you want such as function as you posted containing those parameters I'd recommend you name it something else. As you've seen, WinMain won't work.

Otherwise, if you wish to use the already defined WinMain (such as it is), then you are going to have to supply it with the correct parameter list.
This is a C++/CLI application so you need a main function.

1
2
3
4
5
6
7
8
9
int main() 
{
  Application::EnableVisualStyles();
  Application::SetCompatibleTextRenderingDefault(false);
  RoExplorerV2::MyForm mainForm;
  Application::Run(%mainForm);

  return 0;
}


Make sure that you set the entry point in the linker to main. If it doesn't work have a look at my template.
https://www.dropbox.com/sh/vnh3gc1l0ke90qg/AAAxiUpBUyoN5WXXzROXxMNia?dl=0
Topic archived. No new replies allowed.