Unable to link DWT build

Jacob Carlborg via Digitalmars-d-dwt digitalmars-d-dwt at puremagic.com
Sat Nov 21 06:32:46 PST 2015

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"
> 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

More information about the Digitalmars-d-dwt mailing list