www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - LDC2 -I option results in unresolved externals

reply spikespaz <spikespaz outlook.com> writes:
I'm using the latest LDC2 beta, and when running the compiler 
with -I (Look for imports also in <directory>) it fails with 
unresolved externals. These are my commands.

=====================================================

$ ldc2 "source\setup.d" -I "source" -J "build\vars" -of 
"build\bin\setup.exe" -m32 -g
setup.obj : error LNK2019: unresolved external symbol 
__D6common17createErrorDialogFxC9ExceptionZv referenced in 
function __Dmain
setup.obj : error LNK2019: unresolved external symbol 
__D6common14getConsoleArgsFxPuZAAya referenced in function 
__D5setup20getAvailableBrowsersFZ14__foreachbody1MFKC3std7windows8registry3KeyZi
setup.obj : error LNK2001: unresolved external symbol 
__D6common12__ModuleInfoZ
build\bin\setup.exe : fatal error LNK1120: 3 unresolved externals
Error: C:\Program Files (x86)\Microsoft Visual 
Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\link.exe
failed with status: 1120

=====================================================

But this next one works fine.

=====================================================

$ ldc2 "source\setup.d" "source/common.d" -J "build\vars" -of 
"build\bin\setup.exe" -m32 -g

=====================================================

I'm using LDC2 version 1.12.0-beta2, on DMD v2.082.0, on Windows 
with VS Build Tools 2017.
Any solutions or corrections appreciated.
Oct 11 2018
parent reply Mike Parker <aldacron gmail.com> writes:
On Friday, 12 October 2018 at 06:01:12 UTC, spikespaz wrote:
 I'm using the latest LDC2 beta, and when running the compiler 
 with -I (Look for imports also in <directory>) it fails with 
 unresolved externals. These are my commands.

 =====================================================

 $ ldc2 "source\setup.d" -I "source" -J "build\vars" -of 
 "build\bin\setup.exe" -m32 -g
 setup.obj : error LNK2019: unresolved external symbol 
 __D6common17createErrorDialogFxC9ExceptionZv referenced in 
 function __Dmain
 setup.obj : error LNK2019: unresolved external symbol 
 __D6common14getConsoleArgsFxPuZAAya referenced in function 
 __D5setup20getAvailableBrowsersFZ14__foreachbody1MFKC3std7windows8registry3KeyZi
 setup.obj : error LNK2001: unresolved external symbol 
 __D6common12__ModuleInfoZ
 build\bin\setup.exe : fatal error LNK1120: 3 unresolved 
 externals
 Error: C:\Program Files (x86)\Microsoft Visual 
 Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\link.exe
failed with status: 1120

 =====================================================

 But this next one works fine.

 =====================================================

 $ ldc2 "source\setup.d" "source/common.d" -J "build\vars" -of 
 "build\bin\setup.exe" -m32 -g

 =====================================================

 I'm using LDC2 version 1.12.0-beta2, on DMD v2.082.0, on 
 Windows with VS Build Tools 2017.
 Any solutions or corrections appreciated.
-I does not tell the compiler to actually compile the modules it finds in the given directory. It's only for symbol lookup. DMD has the -i option which tells the compiler to automatically compile all imported modules. I don't know if LDC has anything similar, the wiki page listing its command line options hasn't been updated in a while.
Oct 12 2018
parent Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Friday, 12 October 2018 at 07:32:26 UTC, Mike Parker wrote:

 DMD has the -i option which tells the compiler to automatically 
 compile all imported modules. I don't know if LDC has anything 
 similar.
It does, same option.
Oct 12 2018