Jump to page: 1 2
Thread overview
D on Windows - linker question
Oct 18, 2013
Erik van Velzen
Oct 18, 2013
Benjamin Thaut
Oct 19, 2013
evilrat
Oct 20, 2013
Erik van Velzen
Oct 21, 2013
evilrat
Oct 21, 2013
Andrew
Oct 21, 2013
evilrat
Oct 21, 2013
Andrew
Oct 21, 2013
evilrat
Oct 22, 2013
Erik van Velzen
Oct 22, 2013
evilrat
October 18, 2013
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"
October 18, 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
October 19, 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.
October 20, 2013
My goal was to learn D and Direct3D at the same time.

I've tried to set up DMD to do this, but I keep running into issues that the available DirectX11 and win32 headers are incomplete, or won't compile (tried both dmd 2.063 and 2.064, they halt on different type errors), or won't link.

To be fair, these are only a few errors, but when the linker spews out some obfuscated function name I really don't know what to do.

Will I have more luck with GDC? Or should I try to make headers on my own incrementally? (or take the easy route and use C++?)
October 21, 2013
On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote:
> My goal was to learn D and Direct3D at the same time.
>
> I've tried to set up DMD to do this, but I keep running into issues that the available DirectX11 and win32 headers are incomplete, or won't compile (tried both dmd 2.063 and 2.064, they halt on different type errors), or won't link.
>
> To be fair, these are only a few errors, but when the linker spews out some obfuscated function name I really don't know what to do.
>
> Will I have more luck with GDC? Or should I try to make headers on my own incrementally? (or take the easy route and use C++?)

i'm currently trying to get up DirectX(d3d10(x),d3d11(x),xaudio2,x3daudio,d3dmath) up and running in free time, but i constantly encounter serious problems on my way. now i have some weird problems with COM(no COM - no DirectX).

so i don't recommend anyone even try it(DirectX) now, unless one is truly skilled with C++

p.s. for working win32 with dmd 2.063.2 go there(don't forget to convert .lib's to OMF, use coffimplib from digitalmars ftp) - https://github.com/AndrejMitrovic/DWinProgramming/tree/master/WindowsAPI
October 21, 2013
On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote:
> On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote:
>> My goal was to learn D and Direct3D at the same time.
>>
>> I've tried to set up DMD to do this, but I keep running into issues that the available DirectX11 and win32 headers are incomplete, or won't compile (tried both dmd 2.063 and 2.064, they halt on different type errors), or won't link.
>>
>> To be fair, these are only a few errors, but when the linker spews out some obfuscated function name I really don't know what to do.
>>
>> Will I have more luck with GDC? Or should I try to make headers on my own incrementally? (or take the easy route and use C++?)
>
> i'm currently trying to get up DirectX(d3d10(x),d3d11(x),xaudio2,x3daudio,d3dmath) up and running in free time, but i constantly encounter serious problems on my way. now i have some weird problems with COM(no COM - no DirectX).
>
> so i don't recommend anyone even try it(DirectX) now, unless one is truly skilled with C++
>
> p.s. for working win32 with dmd 2.063.2 go there(don't forget to convert .lib's to OMF, use coffimplib from digitalmars ftp) - https://github.com/AndrejMitrovic/DWinProgramming/tree/master/WindowsAPI

What it has to do with C++?
October 21, 2013
On Monday, 21 October 2013 at 07:46:41 UTC, Andrew wrote:
> On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote:
>> On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote:
>>> My goal was to learn D and Direct3D at the same time.
>>>
>>> I've tried to set up DMD to do this, but I keep running into issues that the available DirectX11 and win32 headers are incomplete, or won't compile (tried both dmd 2.063 and 2.064, they halt on different type errors), or won't link.
>>>
>>> To be fair, these are only a few errors, but when the linker spews out some obfuscated function name I really don't know what to do.
>>>
>>> Will I have more luck with GDC? Or should I try to make headers on my own incrementally? (or take the easy route and use C++?)
>>
>> i'm currently trying to get up DirectX(d3d10(x),d3d11(x),xaudio2,x3daudio,d3dmath) up and running in free time, but i constantly encounter serious problems on my way. now i have some weird problems with COM(no COM - no DirectX).
>>
>> so i don't recommend anyone even try it(DirectX) now, unless one is truly skilled with C++
>>
>> p.s. for working win32 with dmd 2.063.2 go there(don't forget to convert .lib's to OMF, use coffimplib from digitalmars ftp) - https://github.com/AndrejMitrovic/DWinProgramming/tree/master/WindowsAPI
>
> What it has to do with C++?

nothing. but whole win32/DirectX is either C or C++ with COM. learning them will require thinking that way, while D offers higher level abstraction you won't learn D with this, just D'ish C/C++. it also would require basic understanding of ABI interop between C/D and so on, so experience with win32/C++ would help a lot if any problem encountered.

October 21, 2013
On Monday, 21 October 2013 at 07:56:49 UTC, evilrat wrote:
> On Monday, 21 October 2013 at 07:46:41 UTC, Andrew wrote:
>> On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote:
>>> On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote:
>>>> My goal was to learn D and Direct3D at the same time.
>>>>
>>>> I've tried to set up DMD to do this, but I keep running into issues that the available DirectX11 and win32 headers are incomplete, or won't compile (tried both dmd 2.063 and 2.064, they halt on different type errors), or won't link.
>>>>
>>>> To be fair, these are only a few errors, but when the linker spews out some obfuscated function name I really don't know what to do.
>>>>
>>>> Will I have more luck with GDC? Or should I try to make headers on my own incrementally? (or take the easy route and use C++?)
>>>
>>> i'm currently trying to get up DirectX(d3d10(x),d3d11(x),xaudio2,x3daudio,d3dmath) up and running in free time, but i constantly encounter serious problems on my way. now i have some weird problems with COM(no COM - no DirectX).
>>>
>>> so i don't recommend anyone even try it(DirectX) now, unless one is truly skilled with C++
>>>
>>> p.s. for working win32 with dmd 2.063.2 go there(don't forget to convert .lib's to OMF, use coffimplib from digitalmars ftp) - https://github.com/AndrejMitrovic/DWinProgramming/tree/master/WindowsAPI
>>
>> What it has to do with C++?
>
> nothing. but whole win32/DirectX is either C or C++ with COM. learning them will require thinking that way, while D offers higher level abstraction you won't learn D with this, just D'ish C/C++. it also would require basic understanding of ABI interop between C/D and so on, so experience with win32/C++ would help a lot if any problem encountered.

If you want to offer Direct3D in D as is (I prefer this option instead of wrapper-libraries), you'll have to make it COM'ish and C'ish :-)
I actually consider looking into this problem, I'm skilled C++ graphics programmer.
October 21, 2013
On Monday, 21 October 2013 at 08:12:49 UTC, Andrew wrote:
>
> If you want to offer Direct3D in D as is (I prefer this option instead of wrapper-libraries), you'll have to make it COM'ish and C'ish :-)
> I actually consider looking into this problem, I'm skilled C++ graphics programmer.

i think about both "raw" and D'ish(wrapper) bindings.
October 22, 2013
On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote:
>
> i'm currently trying to get up DirectX(d3d10(x),d3d11(x),xaudio2,x3daudio,d3dmath) up and running in free time, but i constantly encounter serious problems on my way. now i have some weird problems with COM(no COM - no DirectX).
>
> so i don't recommend anyone even try it(DirectX) now, unless one is truly skilled with C++

Thanks for your advice, I suspected as much.

I will hack some more and see if I'm progressing or learning
anything. And decide in a few days if I continue with D3D in D,
or stick to C++. I do have experience in C++, though with server
apps on Linux without native GUIs.

> p.s. for working win32 with dmd 2.063.2 go there(don't forget to convert .lib's to OMF, use coffimplib from digitalmars ftp) - https://github.com/AndrejMitrovic/DWinProgramming/tree/master/WindowsAPI

I'm using COFF with the visual studio linker, so I don't need to
convert.

I do get a few compiler errors with DMD in these win32.* modules
about incorrect typecasts. I will make a new topic if these
persist or file a bug report with the author.
« First   ‹ Prev
1 2