I was coding a program to open a window but when I tried to run it I got error code LNK2019, this is my first time using MSVS and a lot of the results are out dated. I also don’t know much about computers just about programming so a lot are too complicated going over my head I need it explained like I’m 5.
the code:
#include <windows.h>
LRESULT CALLBACK windowproc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
//this handles windows and the messages they get and it uses callback so we can callback to it
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
// gives class name for a wide character
int heightscreen = GetSystemMetrics(SM_CYSCREEN);
//height of screen
int widthscreem = GetSystemMetrics(SM_CXSCREEN);
//width of screen
const wchar_t CLASS_NAME[] = L"Excitble Mediums";
WNDCLASS window = { 0 };
//this is where we define window wich is where we give it a tton of attribute that will help make the window
window.lpfnWndProc = windowproc;
window.lpszClassName = CLASS_NAME;
window.hInstance = hInstance;
//basicly a void of any other object
RegisterClass(&window);
//registars a class for the rest of the code, the & makes a pointer
//create window
HWND hwnd = CreateWindowEx(
WS_EX_OVERLAPPEDWINDOW, //idk seemed like the bset option and it cant be null change if neccercery
CLASS_NAME,
L"Excited meidum", //L makes it work dk why, good to rember tho
WS_SIZEBOX | WS_VISIBLE | WS_POPUP, //jst chose the bst one add or change iif nessery
0, 0, //xy pos
widthscreem,
heightscreen,
NULL,
NULL,
hInstance,
NULL);
//"game"loop starts
MSG msg{ 0 };
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//this will run when the window can get messages
}
the error messgae:
unresolved external symbol "__int64 __cdecl windowproc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?windowproc@@YA_JPEAUHWND__@@I_K_J@Z) referenced in function WinMain
I’m not sure if this enough information so just leave a comment if not I’ll edit the post.
I tried following lot a tuts on how to fix it but most were outdated
Dom Da Bomb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1