D on Windows - linker question

evilrat evilrat666 at gmail.com
Sat Oct 19 05:32:24 PDT 2013


On Friday, 18 October 2013 at 16:52:01 UTC, Benjamin Thaut wrote:
> 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

and i recommend to use dub, which then can generate projects for 
visuald or whatever.


More information about the Digitalmars-d-learn mailing list