Linking phobos64.lib errors

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 3 01:47:30 PDT 2014


On 3/09/2014 7:22 p.m., Szymon Gatner wrote:
> Hi,
>
> I am trying to make simple x64 C++ application that uses D static
> library (trying to do "Interfacing with C++" from "D Cookbook" chapter).
> I am Using Visual Studio 2012 to create main() like this:
>
> #include <iostream>
>
> extern "C" int rt_init();
> extern "C" void rt_term();
> // RAII struct for D runtime initialization and termination
> struct DRuntime {
>    DRuntime() {
>      if(!rt_init()) {
>        // you could also use an exception
>        fprintf(stderr, "D Initialization failed");
>        exit(1);
>      }
>    }
>    ~DRuntime() {
>      rt_term();
>    }
> };
>
> int main()
> {
>    DRuntime druntime;
> }
>
> and then I am just setting linker to link to phobos64.lib but I am
> getting those:
>
> 1>phobos64.lib(dmain2_4ec_2f9.obj) : error LNK2019: unresolved external
> symbol _deh_beg referenced in function rt_init
> 1>phobos64.lib(sections_win64_575_4e2.obj) : error LNK2001: unresolved
> external symbol _deh_beg
> 1>phobos64.lib(sections_win64_57b_5a5.obj) : error LNK2019: unresolved
> external symbol _minfo_end referenced in function
> _D2rt14sections_win6414getModuleInfosFZAyPS6object10ModuleInfo
> 1>phobos64.lib(sections_win64_57b_5a5.obj) : error LNK2019: unresolved
> external symbol _minfo_beg referenced in function
> _D2rt14sections_win6414getModuleInfosFZAyPS6object10ModuleInfo
> 1>phobos64.lib(sections_win64_575_4e2.obj) : error LNK2019: unresolved
> external symbol _deh_end referenced in function
> _D2rt14sections_win6412SectionGroup8ehTablesMxFNdZAyS2rt15deh_win64_posix9FuncTable
>
>
> What am I doing wrong? Book says that on x64 Windows VC++ can be used to
> create hybrid application.

My gut feeling looking at that, is that its not linking against the c 
runtime.

For reference I'm pretty sure _deh_beg is related to exception handling.


More information about the Digitalmars-d-learn mailing list