Linker issue?

Aleksandar Ruzicic aleksandar at ruzicic.info
Mon Jun 17 12:33:53 PDT 2013


On Monday, 17 June 2013 at 13:15:35 UTC, Josh wrote:
> I've copied the source code from vibe.d's mongodb example into 
> an Eclipse DDT project, and I can't seem to get it to compile, 
> even though I *think* I've made the build options resemble what 
> vibe uses to build.
>
> build.rf:
> -od"bin"
> -of"bin\TestProg.exe"
>
> -I"src"
>
> -I"C:\D\vibe.d\source"
> -I"C:\D\vibe.d\import"
> -I"C:\D\vibe.d\lib\win-i386"
>
> "src\Test.d"
>
> C:\D\vibe.d\lib\win-i386\eay.lib
> C:\D\vibe.d\lib\win-i386\event2.lib
> C:\D\vibe.d\lib\win-i386\ssl.lib
> ws2_32.lib
>
> Building with Eclipse gives:
> --------  Build Commands:  --------
> -od"bin"
> -of"bin\TestProg.exe"
>
> -I"src"
>
> -I"C:\D\vibe.d\source"
> -I"C:\D\vibe.d\import"
> -I"C:\D\vibe.d\lib\win-i386"
>
> "src\Test.d"
>
> C:\D\vibe.d\lib\win-i386\eay.lib
> C:\D\vibe.d\lib\win-i386\event2.lib
> C:\D\vibe.d\lib\win-i386\ssl.lib
> ws2_32.lib
>
>
> OPTLINK (R) for Win32  Release 8.00.13
> Copyright (C) Digital Mars 1989-2010  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__initZ
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4data4bson4Bson6__ctorMFNcAyaE4vibe4data4bson4Bson4TypeZS4vibe4data4bson4Bson
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo5mongo14connectMongoDBFAyaZC4vibe2db5mongo6client11MongoClient
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4data4json4Json8toStringMxFZAya
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4data4bson4Bson6toJsonMxFZS4vibe4data4json4Json
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo6cursor11MongoCursor7opApplyMFDFKkKS4vibe4data4bson4BsonZiZi
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo6cursor11MongoCursor6__dtorMFZv
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4data4bson4Bson6__ctorMFNcxHAyaS4vibe4data4bson4BsonZS4vibe4data4bson4Bson
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo8database13MongoDatabase7opIndexMFAyaZS4vibe2db5mongo10collection15MongoCollection
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined _D4vibe4core3log7__arrayZ
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4core3log10ss_loggersOAC4vibe4core3log6Logger
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4core3log6rawLogFNbAyaiE4vibe4core3log8LogLevelAyaZv
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined _D4vibe4core3log8__assertFiZv
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4core14connectionpool8__assertFiZv
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4core4task4Task5fiberMNgFNbNdZNgC4vibe4core4task9TaskFiber
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo6client11M€„ŽC€†�4lockConnectiñMFZS€…¶4core1ꀈšpool67__T16L€ƒ³ed€ŠµTC€Žé10€Š·15€†î€‰‘Z€’À
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe4data4bson4Bson6__ctorMFNcnZS4vibe4data4bson4Bson
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo6cursor11M€„ŽC€…�6__ctñMFNcC€�®lient€ˆ®€…�Ayai€�§10cñnectiñ5ReplyZS€¢÷
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined _D4vibe4core3log12__ModuleInfoZ
> bin\TestProg.obj(TestProg)
>  Error 42: Symbol Undefined 
> _D4vibe2db5mongo5mongo12__ModuleInfoZ
> --- errorlevel 20
>
> dmd is 2.063 on Windows 7.
>
> I know both Eclipse and dmd work, as I can compile other 
> programs that just use Phobos. I'm sure it's something really 
> obvious that I can't see, but I haven't had much luck with 
> external libs. The same sort of thing happened when I used 
> GtkD...
>
> Any help is welcomed.
>
> Thanks,
>
> Josh

This is what DUB executes (when you build a project depending on 
vibe.d) via dub build --rdmd (I've replaced absolute path to the 
project with <path> and added newlines for clarity):

rdmd --build-only --compiler=dmd -w -g -debug
-version=LIBEV4
-version=VibeLibeventDriver
-version=Have_vibe_d
-I<path>\source
-I<path>\.dub\packages\vibe-d\import
-I<path>\.dub\packages\vibe-d\source
-J<path>\views
<path>\.dub\packages\vibe-d\lib\win-i386\eay.lib
<path>\.dub\packages\vibe-d\lib\win-i386\ssl.lib
<path>\.dub\packages\vibe-d\lib\win-i386\event2.lib
wsock32.lib
ws2_32.lib
-ofgamesrv.exe
source\app.d

So it seems you're missing wsock32.lib, but I'm a bit puzzled 
with linker errors, as those missing symbols are not inside 
wsock32.lib..

Sorry I couldn't be of more help (I'm new to vibe also, but 
luckily haven't hit any major build issues like you did).


More information about the Digitalmars-d-learn mailing list