Linker error in WINAPI code
c, c++, winapi
Solution
Since LIB file is used to link against a DLL at compile-time, MessageBoxA resides in user32.dll and requires user32.lib for proper linking. So change `user32.dll` to `user32.lib` in #pragma comment like
`#pragma comment(lib,"user32.lib")`
Problem
I am trying to compile the following code but I am getting linker errors. Thankyou to tell what I am missing. ``` #include <Windows.h> #pragma comment(lib,"user32.dll") int main() { return MessageBoxA(0,"Message","Warn",0x01); } ``` `fatal error LNK1104: cannot open file 'user32.dll'`