Thread overview
modules with the same name in different packages
Sep 29, 2007
Mahe
Sep 29, 2007
Alexander Panek
Sep 29, 2007
Janice Caron
Sep 29, 2007
Bill Baxter
Sep 30, 2007
Mahe
September 29, 2007
Hi,
I have a problem with 2 modules with the same name in different packages. It seems that one module obj overwrites the other.
Is there a possibility to solve that (except renaming the packages, because this would make packages useless)

Here some example source code. I compile it with:
dmd  main.d -odbin
And get the error
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
bin\main.obj(main)
 Error 42: Symbol Undefined _D4pack3mod4Mod27__ClassZ
--- errorlevel 1
#########################################
module pack.mod;

import tango.io.Console;

class Mod2
{
	public void foo()
	{
		Cout( "pack.mod" ).newline;
	}
}
##########################################
module mod;


import tango.io.Console;

class Mod1
{
	public void foo()
	{
		Cout( "mod" ).newline;
	}
}
##########################################
 module main;

import tango.io.Console;

import mod;
import pack.mod;

void main()
{
	Mod1 m1 = new Mod1;
	Mod2 m2 = new Mod2;

	m1.foo;
	m2.foo;

    Cout ("Hello" ).newline;
}




September 29, 2007
On Sat, 29 Sep 2007 15:58:17 -0400
Mahe <maheweb@web.de> wrote:
> dmd  main.d -odbin
> And get the error
> OPTLINK (R) for Win32  Release 8.00.1
> Copyright (C) Digital Mars 1989-2004  All rights reserved.
> bin\main.obj(main)
>  Error 42: Symbol Undefined _D4pack3mod4Mod27__ClassZ
> --- errorlevel 1

It rather seems like you're /missing/ a symbol in your object. Apart from that, you don't compile the other packages, so it's kind of natural that the symbols are missing.

-- 
Alexander Panek <alexander.panek@brainsware.org>
September 29, 2007
On 9/29/07, Mahe <maheweb@web.de> wrote:
> Hi,
> I have a problem with 2 modules with the same name in different packages. It seems that one module obj overwrites the other.

The trick is not to build all the object files in the same directory. :-)
September 29, 2007
Janice Caron wrote:
> On 9/29/07, Mahe <maheweb@web.de> wrote:
>> Hi,
>> I have a problem with 2 modules with the same name in different packages. It seems that one module obj overwrites the other.
> 
> The trick is not to build all the object files in the same directory. :-)

Or use dsss/rebuild which automatically gives the objs unique names based on their directory names.

--bb
September 30, 2007
Bill Baxter Wrote:
> Or use dsss/rebuild which automatically gives the objs unique names based on their directory names.
> 
> --bb


> 
> Or use dsss/rebuild which automatically gives the objs unique names based on their directory names.
> 
> --bb

Oh, thanks!
I had also tried building with rebuild. But with the parameter “-od…” it didn’t work. I now tried without it and it works!
After a closer look into the help of rebuild I found the parameter “-oq…”. Now it also works with an object files directory :-)