digitalmars.D.learn - linker errors with class
- Michael P. (7/7) Oct 25 2008 I'm getting an undefined reference error with Derelict and SDL.
- BCS (2/12) Oct 25 2008 what are the error messages? (copy/pates)
- Michael P. (6/22) Oct 25 2008 C:\Documents and Settings\Default\My Documents\DProjects\Derelict\ build...
- Mike Parker (12/35) Oct 26 2008 The linker is expecting to find a destructor for your SDLImagess class
- Michael P. (2/43) Oct 26 2008 Thanks, that worked. :D
- Denis Koroskin (4/40) Oct 26 2008 No, it shouldn't. You may implement function bodies in other modules
- Mike Parker (5/53) Oct 26 2008 Right, but it just feels wrong to me for constructors & destructors
- torhu (6/15) Oct 26 2008 Without this feature, .di files wouldn't work. The advantage is that
I'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.
Oct 25 2008
Reply to Michael P.,I'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.what are the error messages? (copy/pates)
Oct 25 2008
BCS Wrote:Reply to Michael P.,C:\Documents and Settings\Default\My Documents\DProjects\Derelict\ build imagetest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. SDLImages.obj(SDLImages) Error 42: Symbol Undefined _D9SDLImages11SDL_Imagess5_dtorMFZvI'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.what are the error messages? (copy/pates)
Oct 25 2008
Michael P. wrote:BCS Wrote:The linker is expecting to find a destructor for your SDLImagess class in the object file, but it's not there. Your problem is on line 44 of SDLImages.d: //Destructor ~this(); Your destructor is declared, but not implemented -- hence the error. If you've got nothing to do in the destructor, either implement an empty one: ~this() {} Or take it out entirely, in which case the compiler will generate a default destructor for you. IMO, this should really be a compiler error. I'm surprised it isn't.Reply to Michael P.,C:\Documents and Settings\Default\My Documents\DProjects\Derelict\ build imagetest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. SDLImages.obj(SDLImages) Error 42: Symbol Undefined _D9SDLImages11SDL_Imagess5_dtorMFZvI'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.what are the error messages? (copy/pates)
Oct 26 2008
Mike Parker Wrote:Michael P. wrote:Thanks, that worked. :DBCS Wrote:The linker is expecting to find a destructor for your SDLImagess class in the object file, but it's not there. Your problem is on line 44 of SDLImages.d: //Destructor ~this(); Your destructor is declared, but not implemented -- hence the error. If you've got nothing to do in the destructor, either implement an empty one: ~this() {} Or take it out entirely, in which case the compiler will generate a default destructor for you. IMO, this should really be a compiler error. I'm surprised it isn't.Reply to Michael P.,C:\Documents and Settings\Default\My Documents\DProjects\Derelict\ build imagetest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. SDLImages.obj(SDLImages) Error 42: Symbol Undefined _D9SDLImages11SDL_Imagess5_dtorMFZvI'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.what are the error messages? (copy/pates)
Oct 26 2008
On Sun, 26 Oct 2008 10:03:32 +0300, Mike Parker <aldacron gmail.com> wrote:Michael P. wrote:No, it shouldn't. You may implement function bodies in other modules and/or languages (in C, for example, just make sure names have proper mangling).BCS Wrote:The linker is expecting to find a destructor for your SDLImagess class in the object file, but it's not there. Your problem is on line 44 of SDLImages.d: //Destructor ~this(); Your destructor is declared, but not implemented -- hence the error. If you've got nothing to do in the destructor, either implement an empty one: ~this() {} Or take it out entirely, in which case the compiler will generate a default destructor for you. IMO, this should really be a compiler error. I'm surprised it isn't.Reply to Michael P.,C:\Documents and Settings\Default\My Documents\DProjects\Derelict\ build imagetest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. SDLImages.obj(SDLImages) Error 42: Symbol Undefined _D9SDLImages11SDL_Imagess5_dtorMFZvI'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.what are the error messages? (copy/pates)
Oct 26 2008
Denis Koroskin wrote:On Sun, 26 Oct 2008 10:03:32 +0300, Mike Parker <aldacron gmail.com> wrote:Right, but it just feels wrong to me for constructors & destructors since they are a required part of the class. Either you implement one or you don't, but simply declaring one without an implementation feels like an error to me.Michael P. wrote:No, it shouldn't. You may implement function bodies in other modules and/or languages (in C, for example, just make sure names have proper mangling).BCS Wrote:The linker is expecting to find a destructor for your SDLImagess class in the object file, but it's not there. Your problem is on line 44 of SDLImages.d: //Destructor ~this(); Your destructor is declared, but not implemented -- hence the error. If you've got nothing to do in the destructor, either implement an empty one: ~this() {} Or take it out entirely, in which case the compiler will generate a default destructor for you. IMO, this should really be a compiler error. I'm surprised it isn't.Reply to Michael P.,C:\Documents and Settings\Default\My Documents\DProjects\Derelict\ build imagetest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. SDLImages.obj(SDLImages) Error 42: Symbol Undefined _D9SDLImages11SDL_Imagess5_dtorMFZvI'm getting an undefined reference error with Derelict and SDL. I tried to create an SDLImage class, but I got an error when the files try to link together. I've attached the two .d files in a rar. I compiled with "build imagetest". I have Bud 3.04, and DMD version 1.036. I have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P.what are the error messages? (copy/pates)
Oct 26 2008
Mike Parker wrote: ...Denis Koroskin wrote:Without this feature, .di files wouldn't work. The advantage is that functions without bodies are faster for the compiler to parse, when it it's not going to compile them anyway. You can also use it for hiding implementation, if you don't want your source to be available.No, it shouldn't. You may implement function bodies in other modules and/or languages (in C, for example, just make sure names have proper mangling).Right, but it just feels wrong to me for constructors & destructors since they are a required part of the class. Either you implement one or you don't, but simply declaring one without an implementation feels like an error to me.
Oct 26 2008