digitalmars.D - Weird Link Error
- Daniel (64/64) Sep 20 2012 I have searched everywhere and I can't find anything so I decided
- Adam D. Ruppe (2/3) Sep 20 2012 Does your program have a main() function?
- Daniel (4/7) Sep 20 2012 Oh wow I had the main function inside a class, I can't believe
- Adam D. Ruppe (3/5) Sep 20 2012 The linker errors are really hard to read if you haven't seen
- Daniel (5/10) Sep 20 2012 Yeah I'm new to D if you couldn't tell. I figured it must have
- Jens Mueller (9/78) Sep 20 2012 Can you attach the Test.d?
- freeman (5/71) Sep 20 2012 I started seeing these same errors after installing 2.6. Perhaps
I have searched everywhere and I can't find anything so I decided to come here. I have a simple Hello World program in the file Test.d, it compiles just fine but when I try this... [daniel arch D]$ dmd Test.o /usr/lib/libphobos2.a(dmain2_459_1a5.o): In function `_D2rt6dmain24mainUiPPaZi7runMainMFZv': (.text._D2rt6dmain24mainUiPPaZi7runMainMFZv+0x10): undefined reference to `_Dmain' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x4): undefined reference to `_deh_beg' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0xc): undefined reference to `_deh_beg' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x13): undefined reference to `_deh_end' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x36): undefined reference to `_deh_end' /usr/lib/libphobos2.a(thread_18f_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_18f_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x24): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_19f_6e4.o): In function `thread_attachThis': (.text.thread_attachThis+0xb7): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_19f_6e4.o): In function `thread_attachThis': (.text.thread_attachThis+0xbc): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17d_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17d_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x27): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_17e_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17e_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread+0x27): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_17a_713.o): In function `thread_entryPoint': (.text.thread_entryPoint+0x64): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17a_713.o): In function `thread_entryPoint': (.text.thread_entryPoint+0x6a): undefined reference to `_tlsstart' collect2: error: ld returned 1 exit status --- errorlevel 1 I would try to solve the problem myself, except that I have no clue wtf this means.
Sep 20 2012
On Thursday, 20 September 2012 at 13:08:19 UTC, Daniel wrote:undefined reference to `_Dmain'Does your program have a main() function?
Sep 20 2012
On Thursday, 20 September 2012 at 13:12:41 UTC, Adam D. Ruppe wrote:On Thursday, 20 September 2012 at 13:08:19 UTC, Daniel wrote:Oh wow I had the main function inside a class, I can't believe the answer was so simple. I feel like an idiot now.undefined reference to `_Dmain'Does your program have a main() function?
Sep 20 2012
On Thursday, 20 September 2012 at 13:19:08 UTC, Daniel wrote:Oh wow I had the main function inside a class, I can't believe the answer was so simple. I feel like an idiot now.The linker errors are really hard to read if you haven't seen them before (and sometimes even then)...
Sep 20 2012
On Thursday, 20 September 2012 at 13:38:03 UTC, Adam D. Ruppe wrote:On Thursday, 20 September 2012 at 13:19:08 UTC, Daniel wrote:Yeah I'm new to D if you couldn't tell. I figured it must have been something I did wrong when I installed dmd, but I guess it was just a dumb mistake.Oh wow I had the main function inside a class, I can't believe the answer was so simple. I feel like an idiot now.The linker errors are really hard to read if you haven't seen them before (and sometimes even then)...
Sep 20 2012
Daniel wrote:I have searched everywhere and I can't find anything so I decided to come here. I have a simple Hello World program in the file Test.d, it compiles just fine but when I try this...Can you attach the Test.d? But it looks like you didn't define a main function.[daniel arch D]$ dmd Test.o /usr/lib/libphobos2.a(dmain2_459_1a5.o): In function `_D2rt6dmain24mainUiPPaZi7runMainMFZv': (.text._D2rt6dmain24mainUiPPaZi7runMainMFZv+0x10): undefined reference to `_Dmain' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x4): undefined reference to `_deh_beg' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0xc): undefined reference to `_deh_beg' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x13): undefined reference to `_deh_end' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x36): undefined reference to `_deh_end' /usr/lib/libphobos2.a(thread_18f_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_18f_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x24): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_19f_6e4.o): In function `thread_attachThis': (.text.thread_attachThis+0xb7): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_19f_6e4.o): In function `thread_attachThis': (.text.thread_attachThis+0xbc): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17d_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17d_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x27): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_17e_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17e_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread+0x27): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_17a_713.o): In function `thread_entryPoint': (.text.thread_entryPoint+0x64): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17a_713.o): In function `thread_entryPoint': (.text.thread_entryPoint+0x6a): undefined reference to `_tlsstart' collect2: error: ld returned 1 exit status --- errorlevel 1 I would try to solve the problem myself, except that I have no clue wtf this means.These are linker errors. Just read the first two line:/usr/lib/libphobos2.a(dmain2_459_1a5.o): In function `_D2rt6dmain24mainUiPPaZi7runMainMFZv': (.text._D2rt6dmain24mainUiPPaZi7runMainMFZv+0x10): undefined reference to `_Dmain'The linker looks for a D main function since it is referenced in the function with mangled name _D2rt6dmain24mainUiPPaZi7runMainMFZv. But it cannot find it (i.e. the reference is undefined) you'll get this error and subsequent errors. Jens
Sep 20 2012
I started seeing these same errors after installing 2.6. Perhaps it is a linker problem tied to some conf file (in debian or dmd)? The crude solution that works for me is to delete / re-establish soft-linked libraries. On Thursday, 20 September 2012 at 13:08:19 UTC, Daniel wrote:I have searched everywhere and I can't find anything so I decided to come here. I have a simple Hello World program in the file Test.d, it compiles just fine but when I try this... [daniel arch D]$ dmd Test.o /usr/lib/libphobos2.a(dmain2_459_1a5.o): In function `_D2rt6dmain24mainUiPPaZi7runMainMFZv': (.text._D2rt6dmain24mainUiPPaZi7runMainMFZv+0x10): undefined reference to `_Dmain' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x4): undefined reference to `_deh_beg' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0xc): undefined reference to `_deh_beg' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x13): undefined reference to `_deh_end' /usr/lib/libphobos2.a(deh2_43b_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': (.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x36): undefined reference to `_deh_end' /usr/lib/libphobos2.a(thread_18f_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_18f_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x24): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_19f_6e4.o): In function `thread_attachThis': (.text.thread_attachThis+0xb7): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_19f_6e4.o): In function `thread_attachThis': (.text.thread_attachThis+0xbc): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17d_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17d_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x27): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_17e_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread+0x1d): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17e_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread': (.text._D4core6thread6Thread6__ctorMFDFZvkZC4core6thread6Thread+0x27): undefined reference to `_tlsstart' /usr/lib/libphobos2.a(thread_17a_713.o): In function `thread_entryPoint': (.text.thread_entryPoint+0x64): undefined reference to `_tlsend' /usr/lib/libphobos2.a(thread_17a_713.o): In function `thread_entryPoint': (.text.thread_entryPoint+0x6a): undefined reference to `_tlsstart' collect2: error: ld returned 1 exit status --- errorlevel 1 I would try to solve the problem myself, except that I have no clue wtf this means.
Sep 20 2012