www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - import issue (i think)

reply Johan Granberg <lijat.meREM OVEgmail.com> writes:
Does anyone know what causes the following error?

gdc -c input.d -o input.o -I../..
../../sdl/main.d:79: import sdl.main.std conflicts with sige.string.std 
at ../../sige/string.d:2
../../sdl/main.d:79: import sdl.main.std conflicts with sige.string.std 
at ../../sige/string.d:2
input.d:396: template instance cannot resolve forward reference
input.d:396: template sige.string.split(T,D) cannot deduce template 
function from argument types (dchar[])
input.d:396: cannot implicitly convert expression ((split(T,D))((k))) of 
type int to dchar[][]

the code in input.d compiled fine until i tried to move it to it's own 
file but it was never in the same file as sige/string.d and that module 
was imported along with sdl.sdl then to. I can show code if you want to 
but is a bit unsure about what to show so if you are interested tell me 
which parts is important.
Jun 19 2006
parent reply "Derek Parnell" <derek psych.ward> writes:
On Mon, 19 Jun 2006 21:52:41 +1000, Johan Granberg  
<lijat.meREM OVEgmail.com> wrote:

 Does anyone know what causes the following error?

 gdc -c input.d -o input.o -I../..
 ../../sdl/main.d:79: import sdl.main.std conflicts with sige.string.std  
 at ../../sige/string.d:2
 ../../sdl/main.d:79: import sdl.main.std conflicts with sige.string.std  
 at ../../sige/string.d:2
 input.d:396: template instance cannot resolve forward reference
 input.d:396: template sige.string.split(T,D) cannot deduce template  
 function from argument types (dchar[])
 input.d:396: cannot implicitly convert expression ((split(T,D))((k))) of  
 type int to dchar[][]

 the code in input.d compiled fine until i tried to move it to it's own  
 file but it was never in the same file as sige/string.d and that module  
 was imported along with sdl.sdl then to. I can show code if you want to  
 but is a bit unsure about what to show so if you are interested tell me  
 which parts is important.

Ignore the template messages. They will disappear once the other problem is fixed. There is no easy way to find the line of code that is causing this problem. The error message is totally useless because it gives a lot of detail which is misleading or not relevant. Anyhow, the problem you have got is that somewhere in your code, probably in 'input.d' you have a qualified reference to a function but haven't explicitly imported that module, but you have imported two other modules (sdl.main.std and sige.string.std) that have imported that module. This can probably happen under a number of circumstances, but one example is ... import foo; import bar; . . . x = abc.def.func(); In this case, the coder has qualified 'func' with 'abc.def.' but has not imported that module, and both foo.d and bar.d have directly or indirectly imported 'abc.<something>'. -- Derek Parnell Melbourne, Australia
Jun 19 2006
parent Johan Granberg <lijat.meREM OVEgmail.com> writes:
Derek Parnell wrote:
 There is no easy way to find the line of code that is causing this 
 problem. The error message is totally useless because it gives a lot of 
 detail which is misleading or not relevant. Anyhow, the problem you have 
 got is that somewhere in your code, probably in 'input.d' you have a 
 qualified reference to a function but haven't explicitly imported that 
 module, but you have imported two other modules (sdl.main.std and 
 sige.string.std) that have imported that module. This can probably 
 happen under a number of circumstances, but one example is ...
 
  import foo;
  import bar;
  . . .
      x = abc.def.func();
 
 In this case, the coder has qualified 'func' with 'abc.def.' but has not 
 imported that module, and both foo.d and bar.d have directly or 
 indirectly imported 'abc.<something>'.
 
 
 --Derek Parnell
 Melbourne, Australia

thanks this fixed it. ps. Walter please fix the import issues.
Jun 19 2006