gcc linkage problem with C & D

Charles D Hixson charleshixsn at earthlink.net
Wed Jul 25 17:28:02 PDT 2007


Here's what I have.  I hope it makes sense to other people:
test0c.c is -->
#include	<stdio.h>

int	test()
{  printf ("Hello, world\n");
    return  0;
}

//int main(int argc, char *argv[])
//{	return	test(argc, argv);	}

test0d.d is -->
extern(C):
	int	test();

void	main()
{	test;	}

Makefile.test0 is -->
all:  test0

test0:  test0d.o test0c.o
	$(CC)	test0d.o test0c.o -o test0

test0d.o:
	dmd  -c test0d.d $(LL)  -I~/src/phobos test0c.o

test0c.o: test0c.c
	$(CC)  -c test0c.c -o test0c.o

clean:
	rm -f *.o  test0

THEN:
$ make -fMakefile.test0
dmd  -c test0d.d   -I~/src/phobos test0c.o
cc  -c test0c.c -o test0c.o
cc      test0d.o test0c.o -o test1
test0d.o: In function `gcc2_compiled.':
test0d.d:(.text+0x8): undefined reference to `_Dmodule_ref'
collect2: ld returned 1 exit status
make: *** [test0] Error 1

I don't know how to even get started addressing this problem. 
  bud dies with even less informative messages.


More information about the Digitalmars-d-learn mailing list