Reference to an unresolved external symbol

Injeckt vinsentlou9 at gmail.com
Wed Sep 7 09:53:47 UTC 2022


Hi guys, I have an issue when I compile program with using 
windows api, I got this message:
"reference to an unresolved external symbol _MessageBoxW at 16". I 
just created simple hello world using winapi and MessageBox.

     import core.runtime;
     import std.stdio;
     import std.string;
     import core.sys.windows.windows;

     extern(Windows)
     int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
LPSTR cmdLine, int nCmdShow) {
         int result;

         try {
             Runtime.initialize();
             result = myWinMain(hInstance, hPrevInstance, cmdLine, 
nCmdShow);
             Runtime.terminate();
         } catch (Throwable e) {
             result = 0;
         }

         return result;
     }

     int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
LPSTR cmdLine, int nCmdShow) {
         MessageBox(null, "Hello", "D!", MB_OK);

         return 0;
     }


More information about the Digitalmars-d-learn mailing list