www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linker error for core.sys.windows.winuser imports when compiling as 64

reply spikespaz <spikespaz outlook.com> writes:
Hey guys, I'm getting a linker error when compiling with DMD 
`-m63` that I don't get as 23 bit.

I'm importing `ShowWindow` from `core.sys.windows.winuser`, and I 
get the following:

C:\D\dmd2\windows\bin\lld-link.exe: warning: main.obj: undefined 
symbol: ShowWindow
error: link failed
Error: linker exited with status 1

My compiler command is `dmd main.d -m64 -i -O -release -inline 
-boundscheck=off
`.

I don't think the source code would make a difference other than 
to say that I'm calling `ShowWindow`.

Any help would be much appreciated. Thanks!

Also, how does formatting work? Markdown doesn't seem to work, or 
HTML.
Jun 30 2018
parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Sunday, July 01, 2018 00:42:30 spikespaz via Digitalmars-d-learn wrote:
 Hey guys, I'm getting a linker error when compiling with DMD
 `-m63` that I don't get as 23 bit.

 I'm importing `ShowWindow` from `core.sys.windows.winuser`, and I
 get the following:

 C:\D\dmd2\windows\bin\lld-link.exe: warning: main.obj: undefined
 symbol: ShowWindow
 error: link failed
 Error: linker exited with status 1

 My compiler command is `dmd main.d -m64 -i -O -release -inline
 -boundscheck=off
 `.

 I don't think the source code would make a difference other than
 to say that I'm calling `ShowWindow`.

 Any help would be much appreciated. Thanks!
Well, per the MSDN page, that symbol is in User32.lib, so make sure that you're linking against it - though why it would link against it with 32-bit and not 64-bit, I don't know.
 Also, how does formatting work? Markdown doesn't seem to work, or
 HTML.
For the web forum you mean? It's just a web client for the newsgroups that we use, and many folks interact with it as a newsgroup or via the mailing list interface rather than through forum.dlang.org. So, it's expected that everything will be in plain text. - Jonathan M Davis
Jun 30 2018
parent Chris M. <chrismohrfeld comcast.net> writes:
On Sunday, 1 July 2018 at 01:16:59 UTC, Jonathan M Davis wrote:
 On Sunday, July 01, 2018 00:42:30 spikespaz via 
 Digitalmars-d-learn wrote:
 Hey guys, I'm getting a linker error when compiling with DMD 
 `-m63` that I don't get as 23 bit.

 I'm importing `ShowWindow` from `core.sys.windows.winuser`, 
 and I get the following:

 C:\D\dmd2\windows\bin\lld-link.exe: warning: main.obj: 
 undefined
 symbol: ShowWindow
 error: link failed
 Error: linker exited with status 1

 My compiler command is `dmd main.d -m64 -i -O -release -inline
 -boundscheck=off
 `.

 I don't think the source code would make a difference other 
 than to say that I'm calling `ShowWindow`.

 Any help would be much appreciated. Thanks!
Well, per the MSDN page, that symbol is in User32.lib, so make sure that you're linking against it - though why it would link against it with 32-bit and not 64-bit, I don't know. - Jonathan M Davis
Check to make sure it's actually defined in user32.lib. I'm having a similar issue and would love to know why these functions are apparently not being defined https://forum.dlang.org/thread/ncarbitntjeobljragfd forum.dlang.org
Jul 01 2018