dub / win 64 / unresolved externals from run-time lib?

Robert M. Münch robert.muench at saphirion.com
Thu Mar 8 22:06:06 UTC 2018


On 2018-03-08 17:24:32 +0000, kinke said:

> On Thursday, 8 March 2018 at 17:03:18 UTC, Robert M. Münch wrote:
>> Using Dub and pretty simple setup, that links in 3 C/C++ static 
>> libraries, I get these linker errors:
>> 
>> libyogacore.lib(Yoga.obj) : error LNK2019: unresolved external symbol 
>> __imp_fmodf referenced in function "void __cdecl 
>> YGRoundToPixelGrid(struct YGNode * const,float,float,float)" 
>> (?YGRoundToPixelGrid@@YAXQEAUYGNode@@MMM at Z)
>> 
>> libyogacore.lib(Yoga.obj) : error LNK2019: unresolved external symbol 
>> __imp__CrtDbgReportW referenced in function "void * __cdecl 
>> std::_Allocate_manually_vector_aligned<struct 
>> std::_Default_allocate_traits>(unsigned __int64)" 
>> (??$_Allocate_manually_vector_aligned at U_Default_allocate_traits@std@@@std@@YAPEAX_K at Z) 
>> 
>> 
>> 
>> The first I don't understand as it should be in some run-time 
>> libraries. The second indicates a problem with debug / non-debug 
>> runtime libraries. However, I would expect that the correct run-time 
>> libraries are used.
>> 
>> I'm building my code with just: dub build --arch=x86_64
>> 
>> Any idea?
> 
> By the looks of it, the C(++) libs have been compiled with /MDd (debug 
> DLL version of MSVC runtime libs),

Hi, that's correct.

> while DMD and LDC default to the static (release) libs, i.e., /MT.

Interesting... this little but important detail is not very well 
document. The only reference I found is [1] but nothing in the official 
compiler documentation page.

>  The according switch for DMD/LDC is `-mscrtlib` IIRC.

Yes, it is. Seems there is no difference between multi-threaded and 
non-multi-threaded.

Thanks, that worked.

[1] https://dlang.org/changelog/2.073.0.html#mscrtlib-option

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list