I must use main() and call a function from windows.h
.
The following code wants a WinMain()
function to be used instead of main()
.
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int vk_Shift = 16;
while (1)
{
if (GetAsyncKeyState(vk_Shift) < 0)
{
printf("Shift is pressed\n");
}
}
}
Error
Error 1 error LNK2019: unresolved external symbol _WinMain@16
referenced in function ___tmainCRTStartup
Error 2 error LNK1120: 1 unresolved externals
How can I get this work in VS2013?
Okay, guys, I got it.
Felix Palmen's advice works.
... ... I guess configuring it as "console" application should do the trick.
So, what I did is, I changed my project's preference from WIDOWS
to CONSOLE
.