Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » What is "resolving _WinMain@16 by linking to _WinMain"(C++, Eclipse)
What is "resolving _WinMain@16 by linking to _WinMain" [message #1833377] Mon, 12 October 2020 00:36 Go to next message
Lon Phan is currently offline Lon PhanFriend
Messages: 1
Registered: October 2020
Junior Member
I'm still pretty new at c++ so don't be too harsh but when I was compiling, this warning happened:

c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: warning: resolving _WinMain@16 by linking to _WinMain

and here is my code if you all are wondering:

#include <iostream>
#include <cmath>
#include <SDL.h>
using namespace std;

double power(double base, int exponent)
{
double result = 1;

for(int i = 0; i < exponent; i++)
{
result = result * base;
}
return result;
}

int WinMain()

{

bool ttrue = true;
cout << "Hello would you like to use the Exponent Calculator? Type yes to continue.";
string answer;
cin >> answer;

if(answer == "yes")
{
ttrue = 1;
cout << "That's great! We'll need to find out a few stuff from you first. ";
}

else if(answer != "yes")
{
ttrue = false;
cout << "Then what are you doing here? Get out!";
}


if(ttrue == 1)
{
int base, exponent;
cout << "What is the base?: ";
cin >> base;
cout << "What is the exponent?: ";
cin >> exponent;
double myPower = power(base,exponent);
cout << "Your final answer is " << myPower << "!";

}

return 0;

}

as you can see, I am using WinMain because one of the libraries, SDL, requires the use of it. Changing WinMain to regular main will cause an error instead of a warning. Obviously, I want a warning-free compilation so any ideas?
Re: What is "resolving _WinMain@16 by linking to _WinMain" [message #1833410 is a reply to message #1833377] Mon, 12 October 2020 13:30 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Sounds similar to this article:
https://mail.gnome.org/archives/vala-list/2012-March/msg00079.html
_WinMain is the default for a missing WinMain in your code.

It could be because your WinMain doesn't have the proper signature.
Since you are using C++ this is critical.

https://mail.gnome.org/archives/vala-list/2012-March/msg00079.html
INT WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR lpCmdLine, INT nCmdShow)
{
    return 0;
}


An example using MinGW
https://www.transmissionzero.co.uk/computing/win32-apps-with-mingw/
Scroll down to The Application's WinMain Procedure

Previous Topic:"Nothing to build" problem
Next Topic:Unable to add some characters in editor.
Goto Forum:
  


Current Time: Fri Nov 15 04:00:44 GMT 2024

Powered by FUDForum. Page generated in 0.04285 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top