Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

"Unresolved external symbols" when compiling on Windows #34

Closed
andrejp88 opened this issue Nov 24, 2019 · 3 comments
Closed

"Unresolved external symbols" when compiling on Windows #34

andrejp88 opened this issue Nov 24, 2019 · 3 comments
Assignees
Labels
bug windows Specific to the Windows platform

Comments

@andrejp88
Copy link

andrejp88 commented Nov 24, 2019

  • OS: Windows

Bug: When dub gets to the linking step, the following errors occur:

scone.lib(windows_3c8_38d.obj) : error LNK2019: unresolved external symbol GetSystemMetrics referenced in function _D5scone2os7windows9WindowsOS6resizeFxkxkZv
scone.lib(windows_3c8_38d.obj) : error LNK2019: unresolved external symbol SetWindowPos referenced in function _D5scone2os7windows9WindowsOS10repositionFNbNiiiZv
.dub\build\application-debug-windows-x86_64-dmd_2088-F83972565FA2F7DB289FECBA209E86F8\openmc173.exe : fatal error LNK1120: 2 unresolved externals
Error: linker exited with status 1120
dmd failed with exit code 1.

tl;dr It fails to locate "GetSystemMetrics" and "SetWindowPos".

Reproduce: I added scone 2.1.2 to my dependencies, copied in the example code from the readme, and compiled using the following command:
dub run --compiler=dmd -a=x86_64 -b=debug -c=application'

Additional context: I fixed this by going into scone/os/windows.d and adding the following line:
pragma(lib, "User32.lib");
Which was suggested in this thread on the D forums.

I'd make a pull request, but I don't know if this is the "right" way to fix this error, and it may not even be scone's fault, since it isn't the one who declares those external symbols.

@vladdeSV
Copy link
Owner

I cannot reproduce this on my PC, but I got an email today about this exact issue.

Looking into it.

@vladdeSV vladdeSV added bug windows Specific to the Windows platform labels Nov 24, 2019
@vladdeSV vladdeSV self-assigned this Nov 24, 2019
@vladdeSV
Copy link
Owner

Also, that is me and Dennis in that thread ;)

@vladdeSV
Copy link
Owner

I think I've solved it, but unsure why this bug started to happen. Going to do some more testing.

If the problem still persists, please reopen this issue 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug windows Specific to the Windows platform
Projects
None yet
Development

No branches or pull requests

2 participants