linking in linux

llee llee at goucher.edu
Fri Sep 28 07:36:20 PDT 2007


I wrote a test program to isolate the problem. The following program (program.d) calls a function named test_function() that is defined in test.d. test.d is displayed after it. When I try to compile the the program I receive an error.

program.d:
------
import test;
void main ()
{
test_function ();
}

test.d:
------

import std.cstream;
void test_function ()
{
dout.writeLine ("test function called.");
{

Compilation:
------
dmd program.d 
...
program.o: (.data+0x30): undefined reference to '_D11test_module12_ModuleInfoZ'
program.o (.gnu.linkonce.t_Dmain+0x4): undefined reference to '_D11test_module13test_functionFZv'
collect2: ld returned 1 exit status
--errorlevel 1





More information about the Digitalmars-d mailing list