digitalmars.D.learn - undefined reference to `_init_12TypeInfo_AAh'
- Yves Jacoby (13/15) Jan 28 2006 I'm trying to program some sorting algorithms in D (mainly to play
- Carlos Santander (4/26) Jan 29 2006 Maybe you can post some code?
- Yves Jacoby (34/59) Jan 30 2006 Here is the code for sort.d:
- Carlos Santander (6/51) Jan 30 2006 Quick fix: add this line to sort.d:
- Yves Jacoby (3/55) Jan 31 2006 Thanks. I fixed it by just writing a function that does it. Anyway, what...
- Carlos Santander (6/9) Jan 31 2006 I don't know about you but I tested it with GDC. Maybe someone who uses ...
I'm trying to program some sorting algorithms in D (mainly to play around). So I have a module called "sort" and a "main.d" which imports "sort". I have a template Sorting, which has the different sorting algorithms. Now, in the module, I wanted to print out an array, with writefln("%s\n",elements); where elements is "T[] elements" and T is the template parameter. Now, when I compile everything:gdc -fbounds-check -c sort.d gdc -fbounds-check -o main sort.o main.d/tmp/ccSBSZs8.o:(.data+0x20): undefined reference to `_init_12TypeInfo_AAh' collect2: ld returned 1 exit status I get this error. Can someone perhaps tell me where the problem is ? If I remove the "writefln(...)" everything links right again. Thank you.
Jan 28 2006
Yves Jacoby escribió:I'm trying to program some sorting algorithms in D (mainly to play around). So I have a module called "sort" and a "main.d" which imports "sort". I have a template Sorting, which has the different sorting algorithms. Now, in the module, I wanted to print out an array, with writefln("%s\n",elements); where elements is "T[] elements" and T is the template parameter. Now, when I compile everything:Maybe you can post some code? -- Carlos Santander Bernalgdc -fbounds-check -c sort.d gdc -fbounds-check -o main sort.o main.d/tmp/ccSBSZs8.o:(.data+0x20): undefined reference to `_init_12TypeInfo_AAh' collect2: ld returned 1 exit status I get this error. Can someone perhaps tell me where the problem is ? If I remove the "writefln(...)" everything links right again. Thank you.
Jan 29 2006
On Sun, 29 Jan 2006 16:00:53 -0500, Carlos Santander wrote:Yves Jacoby escribió:Here is the code for sort.d: ------------------------ module sort; import std.stdio; import std.random; template Sorting(T) { void insertSort(T[] elements) in{ } out{ } body { writefln("%s\n",elements); } } ------------------------ and main.d ------------------------ import std.stdio; import std.random; import sort; static uint ELNUM = 4000; int main(){ ubyte[][] strings = new ubyte[][ELNUM]; for(int i = 0;i<ELNUM;i++){ strings[i] = new ubyte[rand()%200]; strings[i][] = (rand()%60)+'a'; } Sorting!(ubyte[]).insertSort(strings.dup); return 0; } ------------------------- I tried to reduce it to a minimum that still works.I'm trying to program some sorting algorithms in D (mainly to play around). So I have a module called "sort" and a "main.d" which imports "sort". I have a template Sorting, which has the different sorting algorithms. Now, in the module, I wanted to print out an array, with writefln("%s\n",elements); where elements is "T[] elements" and T is the template parameter. Now, when I compile everything:Maybe you can post some code?gdc -fbounds-check -c sort.d gdc -fbounds-check -o main sort.o main.d/tmp/ccSBSZs8.o:(.data+0x20): undefined reference to `_init_12TypeInfo_AAh' collect2: ld returned 1 exit status I get this error. Can someone perhaps tell me where the problem is ? If I remove the "writefln(...)" everything links right again. Thank you.
Jan 30 2006
Yves Jacoby escribió:Here is the code for sort.d: ------------------------ module sort; import std.stdio; import std.random; template Sorting(T) { void insertSort(T[] elements) in{ } out{ } body { writefln("%s\n",elements); } } ------------------------ and main.d ------------------------ import std.stdio; import std.random; import sort; static uint ELNUM = 4000; int main(){ ubyte[][] strings = new ubyte[][ELNUM]; for(int i = 0;i<ELNUM;i++){ strings[i] = new ubyte[rand()%200]; strings[i][] = (rand()%60)+'a'; } Sorting!(ubyte[]).insertSort(strings.dup); return 0; } ------------------------- I tried to reduce it to a minimum that still works.Quick fix: add this line to sort.d: alias Sorting!(ubyte[]) Sorting_ubyte; The alias name can be anything. It's an ugly fix, but it works. -- Carlos Santander Bernal
Jan 30 2006
On Mon, 30 Jan 2006 19:20:54 -0500, Carlos Santander wrote:Yves Jacoby escribió:Thanks. I fixed it by just writing a function that does it. Anyway, what I wanted to know was more bug in compiler or my error.Here is the code for sort.d: ------------------------ module sort; import std.stdio; import std.random; template Sorting(T) { void insertSort(T[] elements) in{ } out{ } body { writefln("%s\n",elements); } } ------------------------ and main.d ------------------------ import std.stdio; import std.random; import sort; static uint ELNUM = 4000; int main(){ ubyte[][] strings = new ubyte[][ELNUM]; for(int i = 0;i<ELNUM;i++){ strings[i] = new ubyte[rand()%200]; strings[i][] = (rand()%60)+'a'; } Sorting!(ubyte[]).insertSort(strings.dup); return 0; } ------------------------- I tried to reduce it to a minimum that still works.Quick fix: add this line to sort.d: alias Sorting!(ubyte[]) Sorting_ubyte; The alias name can be anything. It's an ugly fix, but it works.
Jan 31 2006
Yves Jacoby escribió:Thanks. I fixed it by just writing a function that does it. Anyway, what I wanted to know was more bug in compiler or my error.I don't know about you but I tested it with GDC. Maybe someone who uses DMD can test it and see what happens (I have a gut feeling it's going to fail too), and if it's so, then a bug report can be posted to D.bugs. -- Carlos Santander Bernal
Jan 31 2006