[linux, ubuntu] personal D module not found in the same directory

Graham Fawcett fawcett at uwindsor.ca
Tue Jun 26 12:50:14 PDT 2012


On Tuesday, 26 June 2012 at 17:23:58 UTC, le TeXnicien de surface 
wrote:
> On Tuesday, 26 June 2012 at 17:14:07 UTC, Jesse Phillips wrote:
>> On Tuesday, 26 June 2012 at 16:55:56 UTC, le TeXnicien de 
>> surface wrote:
>>
>>> and I obtain this message:
>>>
>>> jeteste.o: In function `_Dmain':
>>> jeteste.d:(.text._Dmain+0x1e): undefined reference to
>>> `_D4truc5carreFdZd'
>>> collect2: ld a retourné 1 code d'état d'exécution
>>> --- errorlevel 1
>>>
>>> where do I err?
>>>
>>> any hint would be greatly appreciated
>>>
>>> many thanks in advance
>>
>> D uses a Compile -> link model (like most). You have hit a 
>> linker error, it can not link to an object you haven't given. 
>> But on that the compiler only compiled one file.
>>
>> dmd allFiles.d Of.d theProject.d
>>
>> This will compile the files and pass them to the linker. You 
>> can learn about linking to find out how to handle libraries.
>

You should also be able to do this:

   rdmd --build-only jeteste.d

Normally, the rdmd tool will compile and immediately execute the 
"jeteste" program. Rdmd is "smarter" than dmd, because it will 
calculate all the files that you need to compile and link. 
However, rdmd stores the executable in a different ("hidden") 
directory. (On my computer, it is storing the executable in 
"/tmp/.rdmd-1000/.../".)

But you can call rdmd as "rdmd --build-only". This will compile 
the executable in the *current* directory, and will not execute 
it.

Best,
Graham



More information about the Digitalmars-d-learn mailing list