D on Windows - linker question

Benjamin Thaut code at benjamin-thaut.de
Fri Oct 18 09:52:02 PDT 2013


Am 18.10.2013 18:40, schrieb Erik van Velzen:
> Hello,
> I have set up my enviroment according to these instructions:
> http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_%28COFF-compatible%29
>
>
> When I compile a small tutorial program I get this error:
> error LNK2019: unresolved external symbol MessageBoxW referenced in
> function WinMain
>
> I have to manually specify "User32.Lib" to dmd when I want to compile my
> program (or move User32.Lib to my project directory).
>
> Is this normal?
>
> Below is my sc.ini.
>
> [Environment]
> LIB="%DIR_WINSDK%\Lib\x64";"%DIR_MSVC%\lib\amd64";"%@P%\..\lib"
> DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import" "-m64"
> LINKCMD=%@P%\link.exe
> LINKCMD64=%DIR_MSVC%\bin\amd64\link.exe
>
> Obviously User32.Lib resides in "%DIR_WINSDK%\Lib\x64". This directory
> resolves correctly in windows explorer to "C:\Program Files\Microsoft
> SDKs\Windows\v7.1\Lib\x64"

Yes. It is normal that you have to manually specify User32.lib when 
compiling. At least for x64. I recommend you use visualD which sets up a 
propper windows project for you.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list