digitalmars.D.learn - D on Windows - linker question
- Erik van Velzen (19/19) Oct 18 2013 Hello,
- Benjamin Thaut (6/24) Oct 18 2013 Yes. It is normal that you have to manually specify User32.lib when
- evilrat (3/39) Oct 19 2013 and i recommend to use dub, which then can generate projects for
- Erik van Velzen (10/10) Oct 20 2013 My goal was to learn D and Direct3D at the same time.
- evilrat (11/21) Oct 20 2013 i'm currently trying to get up
- Andrew (2/29) Oct 21 2013 What it has to do with C++?
- evilrat (7/39) Oct 21 2013 nothing. but whole win32/DirectX is either C or C++ with COM.
- Erik van Velzen (11/22) Oct 21 2013 Thanks for your advice, I suspected as much.
- evilrat (11/14) Oct 21 2013 if you use x64 build then i must disappoint you, it only
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"
Oct 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
Oct 18 2013
On Friday, 18 October 2013 at 16:52:01 UTC, Benjamin Thaut wrote:Am 18.10.2013 18:40, schrieb Erik van Velzen:and i recommend to use dub, which then can generate projects for visuald or whatever.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
Oct 19 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++?)
Oct 20 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
Oct 20 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:What it has to do with C++?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
Oct 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: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.On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote:What it has to do with C++?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
Oct 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: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.On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote: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.On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote:What it has to do with C++?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
Oct 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.
Oct 21 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/WindowsAPII'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.
Oct 21 2013
On Tuesday, 22 October 2013 at 01:07:48 UTC, Erik van Velzen wrote: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.if you use x64 build then i must disappoint you, it only converted and works for 32 bit, i have my own "fixed" version of these, but it is hacked to just works. and i don't remember wrong casts in there. do you mixing std.c.windows with this win32? if so, this just because of ambiguity, compiler can't distinguish on itself if multiple definitions exists in one scope. either use alias to specify which symbol to use alias (like this "alias MessageBoxA = std.c.windows.windows;") or static import one of the modules.
Oct 21 2013