Thread overview
"Error 42: Symbol Undefined" for asserts
May 02, 2014
Andre Steenveld
May 02, 2014
FrankLike
May 02, 2014
Andre Steenveld
May 03, 2014
FrankLike
May 03, 2014
Andre Steenveld
Aug 28, 2014
bonzaster
May 02, 2014
Hello all,

I just started learning D and I thought it would be a good idea to port the Reactive Extensions to D. So far so good, I have been using Xamarin Studio in combination with Mono-D on Windows 7 and DMD 2.065.0.

Even though unit testing is baked in to the language I wanted to set up a separate unit test project. Mainly because I am building a library and I also want to test linking to it from a executable. The test project is a console application which is always build with the -unittest flag. The entire project can be found at https://github.com/AndreSteenveld/RDX

Building the library itself seems to work but linking to it breaks for some reason what I am getting from the linker is this:

"""
C:\Program Files\D\2.065.0\dmd2\windows\bin\dmd.exe -unittest -debug -gc "test\main.d" "test\observer.d"  "-IC:\Program Files\D\2.065.0\dmd2\src\druntime\import" "-IC:\Program Files\D\2.065.0\dmd2\src\phobos" "-IC:\Users\Andre\Documents\RDX\RDX" "-odobj\Unittest" "-ofC:\Users\Andre\Documents\RDX\Test\bin\Unittest\Test.exe"


OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx12Notification8__assertFiZv
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx8Observer8__assertFiZv
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx17AnonymousObserver8__assertFiZv
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx9utilities7throwerFZDFNaNfC6object9ThrowableZv
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx9utilities8nop_voidFZDFNaNbNfZv
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx8Observer12__ModuleInfoZ
obj\Unittest\Test.obj(Test)
 Error 42: Symbol Undefined _D3rdx12Notification12__ModuleInfoZ
--- errorlevel 7
"""

I am using code contracts and I thought they were a part of the language, and otherwise that it would be included by building against Phobos and the DRuntime. My questions basically is; What is the linker trying to tell me? And what are the possible solutions?

Cheers,
Andre


May 02, 2014
Maybe not add -L+somelib.lib
May 02, 2014
I seem to have partially solved the problem myself. It seems that when using the Unittest target makes the linker look in to the /bin/Unittest directory even though project can be build using a different target. (right click the solution -> options -> configurations -> Configuration Mappings) Including the dependency has to happen manually and this can be done in the "project properties -> compiling -> linking -> Libraries field". Include a path to the .lib file you want to use and it will be used. You will have to mark the project as a dependency though so it will be build if necessary.

What I am getting from the command line now:

"""

C:\Program Files\D\2.065.0\dmd2\windows\bin\dmd.exe -unittest -debug -gc "test\main.d" "test\observer.d" "../RDX/bin/Debug/libRDX.lib" "-IC:\Program Files\D\2.065.0\dmd2\src\druntime\import" "-IC:\Program Files\D\2.065.0\dmd2\src\phobos" "-IC:\Users\Andre\Documents\RDX\RDX" "-odobj\Unittest" "-ofC:\Users\Andre\Documents\RDX\Test\bin\Unittest\Test.exe"

"""

I'm not completly sure the the -odobj flag is coming from but I think that was the offender and now is just silently ignored because the bin/Unittest directory of the RDX project is empty.

The problem I am running in to now is that Xamarin Studio now launches Test.pdb.exe which doesn't seem to do anything at all.
May 03, 2014
>
> The problem I am running in to now is that Xamarin Studio now launches Test.pdb.exe which doesn't seem to do anything at all.

Use  visual d,it's simple for using pdb.exe
May 03, 2014
On Saturday, 3 May 2014 at 13:18:13 UTC, FrankLike wrote:
>>
>> The problem I am running in to now is that Xamarin Studio now launches Test.pdb.exe which doesn't seem to do anything at all.
>
> Use  visual d,it's simple for using pdb.exe

Which isn't really an option, Visual D is for Visual Studio and the express versions of VS don't allow 3rd party extensions. Also I am convinced it has something to do with Mono-D because debugging does work most of the time.
August 28, 2014
Hi!

If it is still actual: you can try to add dependent project by checking it on Project depencies tab of project options http://savepic.ru/5721500.png
It helps in my case.