Page 1 of 1

Static Linking - EndScene Hooking

Posted: Thu Jan 27, 2011 05:49
by Brkopac
So after a few hours of googling and getting to the same posts and trying everything I can think of I've decided to post as a last ditch if you would :P
There are some of the links I've been working off for the last couple hours with no luck.

viewtopic.php?f=10&t=4738
viewtopic.php?f=10&t=4597

Rebuilt CEGUI as Static_Debug
Visual Studio 2010 for reference.
Made sure my target project is a debug as well.

Libraries being used:

Code: Select all

CEGUISILLYImageCodec_Static_d.lib
winmm.lib
freetype_d.lib
expat_d.lib
pcre_d.lib
SILLY_d.lib
zlib_d.lib
jpeg_d.lib
libpng_d.lib
CEGUIBase_Static_d.lib
CEGUIDirect3D9Renderer_Static_d.lib
CEGUIExpatParser_Static_d.lib
CEGUIFalagardWRBase_Static_d.lib


I've taken the neccecary steps to compile CEGUI as a static library and all the corresponding libraries with the 'Static_Debug' setup and making sure all the projects are compiled with /MDd flag.
Everything seems to be working okay until I get the following error:

Code: Select all

1>CEGUIBase_Static_d.lib(CEGUISystem.obj) : error LNK2019: unresolved external symbol __imp__timeGetTime@0 referenced in function "public: static double __cdecl CEGUI::SimpleTimer::currentTime(void)" (?currentTime@SimpleTimer@CEGUI@@SANXZ)
1>CEGUIBase_Static_d.lib(CEGUISystem.obj) : error LNK2019: unresolved external symbol _createImageCodec referenced in function "private: void __thiscall CEGUI::System::setupImageCodec(class CEGUI::String const &)" (?setupImageCodec@System@CEGUI@@AAEXABVString@2@@Z)
1>CEGUIBase_Static_d.lib(CEGUISystem.obj) : error LNK2019: unresolved external symbol _destroyImageCodec referenced in function "private: void __thiscall CEGUI::System::cleanupImageCodec(void)" (?cleanupImageCodec@System@CEGUI@@AAEXXZ)
1>../../bin/DirectX Hook (dbg).dll : fatal error LNK1120: 3 unresolved externals


After some quick searching I learned I had to throw the 'CEGUISILLYImageCodec_Static_d.lib' and it's corresponding linker files into my project, and winmm. After putting both of those into the linker I get the following error:

Code: Select all

1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl SILLY::SILLYInit(void)" (__imp_?SILLYInit@SILLY@@YA_NXZ) referenced in function "public: __thiscall CEGUI::SILLYImageCodec::SILLYImageCodec(void)" (??0SILLYImageCodec@CEGUI@@QAE@XZ)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl SILLY::SILLYCleanup(void)" (__imp_?SILLYCleanup@SILLY@@YAXXZ) referenced in function "public: virtual __thiscall CEGUI::SILLYImageCodec::~SILLYImageCodec(void)" (??1SILLYImageCodec@CEGUI@@UAE@XZ)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned char const * __thiscall SILLY::Image::getPixelsDataPtr(void)const " (__imp_?getPixelsDataPtr@Image@SILLY@@QBEPBEXZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall SILLY::Image::getWidth(void)const " (__imp_?getWidth@Image@SILLY@@QBEIXZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall SILLY::Image::getHeight(void)const " (__imp_?getHeight@Image@SILLY@@QBEIXZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall SILLY::Image::loadImageData(enum SILLY::PixelFormat,enum SILLY::PixelOrigin)" (__imp_?loadImageData@Image@SILLY@@QAE_NW4PixelFormat@2@W4PixelOrigin@2@@Z) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum SILLY::PixelFormat __thiscall SILLY::Image::getSourcePixelFormat(void)const " (__imp_?getSourcePixelFormat@Image@SILLY@@QBE?AW4PixelFormat@2@XZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall SILLY::MemoryDataSource::~MemoryDataSource(void)" (__imp_??1MemoryDataSource@SILLY@@UAE@XZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall SILLY::Image::~Image(void)" (__imp_??1Image@SILLY@@QAE@XZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall SILLY::Image::loadImageHeader(void)" (__imp_?loadImageHeader@Image@SILLY@@QAE_NXZ) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)"(?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall SILLY::Image::Image(class SILLY::DataSource &)" (__imp_??0Image@SILLY@@QAE@AAVDataSource@1@@Z) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>CEGUISILLYImageCodec_Static_d.lib(CEGUISILLYImageCodec.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall SILLY::MemoryDataSource::MemoryDataSource(unsigned char const *,unsigned int)" (__imp_??0MemoryDataSource@SILLY@@QAE@PBEI@Z) referenced in function "public: virtual class CEGUI::Texture * __thiscall CEGUI::SILLYImageCodec::load(class CEGUI::RawDataContainer const &,class CEGUI::Texture *)" (?load@SILLYImageCodec@CEGUI@@UAEPAVTexture@2@ABVRawDataContainer@2@PAV32@@Z)
1>../../bin/DirectX Hook (dbg).dll : fatal error LNK1120: 12 unresolved externals


This is where it gets weird for me, I thought when you saw __declspec(dllimport) it meant you weren't using the static flag required. I have single, double and triple checked to make sure the preprocessor flag was set under:

Code: Select all

Project Properties -> C/C++ -> Preprocessor = CEGUI_STATIC


I'm wondering if I've just burned myself out for today and am missing a really easy mistake. If anybody has any suggestions please let me know.

Thanks, Brkopac

Re: Static Linking - EndScene Hooking

Posted: Fri Jan 28, 2011 16:06
by Jamarr
The new set of linker errors are referring to SILLY::* functions. Those functions reside in SILLY_d.lib. So the CEGUISILLYImageCodec code expects those SILLY functions to have a __declspec(dllimport) signature, but the functions actually residing SILLY_d.lib do not have that signature. You should be able to figure out the solution from here ;)

Re: Static Linking - EndScene Hooking

Posted: Thu Sep 22, 2011 08:13
by umen
Im getting the same error ... what is the sulotion ?

Re: Static Linking - EndScene Hooking

Posted: Thu Sep 22, 2011 14:20
by Jamarr
You need to rebuild SILLY as a statically-linked library. Silly :lol:

Re: Static Linking - EndScene Hooking

Posted: Thu Sep 22, 2011 14:40
by umen
yes silly , i did that and it worked