www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Unable to link DWT build

reply Paul D Anderson <paul.d.removethis.anderson comcast.andthis.net> writes:
Downloaded DWT win32 and built it okay, but when I try to compile 
and link the "hello world" program I get link errors. I don't 
know enough about the win32 linker to know what the problem is.

The most serious error is org.eclipse.swt.win32.win32.x86.lib 
'Error 43: Not a Valid Library File'.

I'm also having trouble specifying the lib and base directories. 
I get 'File not found lib.lib'. Ditto for base.lib.

The link command line I'm using is
LINK main, lib +"org.eclipse.swt.win32.win32.x86.lib" 
+"dwt-base.lib" /SUBSYSTEM:WINDOWS:4.0"

Where have I gone wrong?

Thanks in advance and sorry if this is a duplicate but couldn't 
find the answer elsewhere on this forum.
Nov 19 2015
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2015-11-20 00:10, Paul D Anderson wrote:
 Downloaded DWT win32 and built it okay, but when I try to compile and
 link the "hello world" program I get link errors. I don't know enough
 about the win32 linker to know what the problem is.

 The most serious error is org.eclipse.swt.win32.win32.x86.lib 'Error 43:
 Not a Valid Library File'.
I'm guessing this is a mismatch between object formats. By default, DMD will create libraries in the OMF format, for 32bit platforms. For 64bit it will create libraries in the COFF format. The OMF format requires the Optlink linker, shipped with DMD. COFF requires the linker from the Microsoft tool chain. It's also possible to output libraries in the COFF format for 32bit platforms, using the -m32mscoff flag.
 I'm also having trouble specifying the lib and base directories. I get
 'File not found lib.lib'. Ditto for base.lib.

 The link command line I'm using is
 LINK main, lib +"org.eclipse.swt.win32.win32.x86.lib" +"dwt-base.lib"
 /SUBSYSTEM:WINDOWS:4.0"

 Where have I gone wrong?
I'm not very familiar with Windows. That last part of the question looks a generic Windows question which is not specific to DWT. I recommend asking in the "learn" forum/group or you could look have a at the build script for DWT [1], which successfully builds and links the snippets. Note also that the command for Optlink was renamed recently from "link" to "optlink" (I think), to avoid conflicting with the Microsoft linker. I recommend using the compiler when linking. [1] https://github.com/d-widget-toolkit/dwt/blob/master/build.d -- /Jacob Carlborg
Nov 21 2015
prev sibling parent Carl Sturtivant <sturtivant gmail.com> writes:
On Thursday, 19 November 2015 at 23:10:46 UTC, Paul D Anderson 
wrote:
 Downloaded DWT win32 and built it okay, but when I try to 
 compile and link the "hello world" program I get link errors. I 
 don't know enough about the win32 linker to know what the 
 problem is.

 The most serious error is org.eclipse.swt.win32.win32.x86.lib 
 'Error 43: Not a Valid Library File'.

 I'm also having trouble specifying the lib and base 
 directories. I get 'File not found lib.lib'. Ditto for base.lib.

 The link command line I'm using is
 LINK main, lib +"org.eclipse.swt.win32.win32.x86.lib" 
 +"dwt-base.lib" /SUBSYSTEM:WINDOWS:4.0"

 Where have I gone wrong?
I just downloaded and built DWT following Jacob's instructions at the bottom of this page. https://github.com/d-widget-toolkit/dwt I made a 64-bit build, and I had no problem linking via dmd, which found the Microsoft linker despite the presence of the 32-bit linker, optlink, which is in the directory on my path where dmd is. Optlink was named link.exe in my version, 2.069.1 which collides with the name of the Microsoft linker. But if I attempt to link from the command line, optlink executes and fails on 64-bit libs. Your link command looks similar to that in the windows 32-bit command on the web page above. So you are attempting to run the 32-bit linker, optlink. I'm assuming this means you attempted a 32-bit build of DWT as on that page, before attempting to compile HelloWorld and link separately. Could you post your exact commands to build DWT, to compile HelloWorld and to link HelloWorld and the entire linker error message?
Nov 23 2015