Page 1 of 2
Problems with CEGUI_STATIC, well, running CEGUI at all
Posted: Mon Jul 07, 2008 07:47
by sipickles
Hi,
Firstly, MSVC2005, CEGUI 0.6.1, prebuilt binaries.
I am trying to statically link to the CEGUI libs. I have defined CEGUI_STATIC before #include "CEGUI.h", and added CEGUIBase_d.lib and DirectX9GUIRenderer_d.lib to the linker inputs.
When I run, the app still wants to load the DLLs, which is not what I expected. If they are present in the path, I get the dreaded SxS error:
Code: Select all
Loaded 'X:\simon\Dev\wc_client\trunk\client\bin\debug\CEGUIBase_d.dll', No symbols loaded.
LDR: LdrpWalkImportDescriptor() failed to probe x:\simon\Dev\wc_client\trunk\client\bin\debug\CEGUIBase_d.dll for its manifest, ntstatus 0xc0150002
I'd like to avoid using the DLLs and just static-link. What am I missing?
Many thanks!
Simon
Posted: Mon Jul 07, 2008 08:16
by scriptkid
Hi,
you should link to the static versions, which are:
-CEGUIBase_Static_d.lib
-DirectX9GUIRenderer_Static_d.lib
Those should not have references to DLLs
HTH.
Posted: Mon Jul 07, 2008 13:04
by sipickles
Ok, that helped a little.
Now I have these link errors:
Code: Select all
Linking...
Creating library ..\..\lib\GUI.lib and object ..\..\lib\GUI.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
CEGUIBase_Static_d.lib(CEGUIFactoryModule.obj) : error LNK2019: unresolved external symbol _registerFactoryFunction referenced in function "public: void __thiscall CEGUI::FactoryModule::registerFactory(class CEGUI::String const &)const " (?registerFactory@FactoryModule@CEGUI@@QBEXABVString@2@@Z)
CEGUIBase_Static_d.lib(CEGUIFactoryModule.obj) : error LNK2019: unresolved external symbol _registerAllFactoriesFunction referenced in function "public: unsigned int __thiscall CEGUI::FactoryModule::registerAllFactories(void)const " (?registerAllFactories@FactoryModule@CEGUI@@QBEIXZ)
DirectX9GUIRenderer_Static_d.lib(d3d9texture.obj) : error LNK2019: unresolved external symbol _DXGetErrorString9A@4 referenced in function "public: virtual void __thiscall CEGUI::DirectX9Texture::loadFromFile(class CEGUI::String const &,class CEGUI::String const &)" (?loadFromFile@DirectX9Texture@CEGUI@@UAEXABVString@2@0@Z)
..\..\lib\GUI.dll : fatal error LNK1120: 3 unresolved externalsLinking...
I have linked to these:
Code: Select all
d3dx9d.lib
d3d9.lib
dxguid.lib
dxerr.lib
CEGUIBase_Static_d.lib
DirectX9GUIRenderer_Static_d.lib
CEGUITinyXMLParser_d.lib
winmm.lib
FreeType.lib
pcre_d.lib
and tried adding:
Code: Select all
#define CEGUI_STATIC
#define CEGUI_WITH_TINYXML
#define CEGUI_FALAGARD_RENDERER
#define CEGUI_CODEC_SILLY
Ow, my head!
![Shocked :shock:](./images/smilies/icon_eek.gif)
Posted: Mon Jul 07, 2008 13:29
by scriptkid
It seems like you're missing the Falagard lib:
CEGUIFalagardWRBase_Static_d.lib
which is responsible for rendering actual cegui widgets.
And you need dxerr9.lib, the one without a number is the DX10 version, IIRC.
Good luck!
Posted: Mon Jul 07, 2008 13:30
by CrazyEddie
try linking:
(or something, though I thought this was automagically done - not sure
![Razz :P](./images/smilies/icon_razz.gif)
)
CE.
Posted: Mon Jul 07, 2008 13:31
by CrazyEddie
Gah! Beaten by 1 minute
![Laughing :lol:](./images/smilies/icon_lol.gif)
Posted: Mon Jul 07, 2008 13:49
by sipickles
I'm trying to build CEGUI into my own DLL, and hoped static linking would simplify this a little.
It builds the DLL but my app cannot load the generated DLL (manifest error again).
Using depends.exe shows that my DLL still depends on CEGUITINYXMLPARSER_D.DLL which in turn depends on CEGUIBASE_D.DLL.
Is this why my my DLL wont load?
Thanks for your patience with my problems....
Posted: Mon Jul 07, 2008 18:56
by sipickles
Well, I noticed I was linking to freetype.lib, not freetype_d.lib.
This removed the warning I was getting about conflicting libraries. Did it help the Side-bySide issue? Nope!
Do I need to worry about the 251 warnings I get saying:
warning LNK4099: PDB 'vc80.pdb' was not found with 'x'
where x is all the CEGUI libs I've statically linked to.....
Posted: Mon Jul 07, 2008 19:42
by CrazyEddie
I'm not sure about the warnings.
With regards to the remaining DLL dependency, this will be because you link against 'CEGUITinyXMLParser_d.lib' is there not a static version of this? I'm not sure as I don't use Windows much, and the static build support even less.
If there is not a static version of the Tiny XML parser module, you might have to either switch to something else (I think Expat has a static version), or hack a little to create a static tiny.
CE.
Posted: Tue Jul 08, 2008 07:30
by sipickles
Hmm, there is a static copy of TinyXML, but using this has no effect. CEGUIExpatParser_Static_d.lib has the same effect - Failed to probe DLL for its manifest.
I notice the DLL loads fine until I add the line:
CEGUI::DirectX9Renderer* myRenderer = new CEGUI::DirectX9Renderer( m_device->Get(), 0 );
Then the DLL Hell kicks in.
So currently, I am linking to:
d3dx9d.lib
d3d9.lib
dxguid.lib
dxerr9.lib
CEGUIBase_Static_d.lib
CEGUIExpatParser_Static_d.lib
CEGUIFalagardWRBase_Static_d.lib
DirectX9GUIRenderer_Static_d.lib
winmm.lib
pcre_d.lib
freetype_d.lib
expat_d.lib
The last three are the dependencies. I need to link to these to get it to compile - is this correct? How come these don't have static versions?
I think I am close to nailing this. I'd be sorry to give in and move the GUI system into my exe. Using a DLL makes patching so easy, in theory!
![Wink ;)](./images/smilies/icon_wink.gif)
Posted: Tue Jul 08, 2008 08:02
by sipickles
Here's a hunch
My app is compiled using multibyte character set. Do the prebuilt CEGUI libs use unicode?
Could that be it?
Thanks
Si
Posted: Tue Jul 08, 2008 08:22
by CrazyEddie
sipickles wrote:The last three are the dependencies. I need to link to these to get it to compile - is this correct? How come these don't have static versions?
We did not provide static versions of those in order that we did not potentially complicate licensing further. Perhaps we may include them in future versions if enough people ask
Not sure about the MBCS thing, we probably use whatever the default is. I'll let scriptkid give the definitive answer to this though.
CE.
Posted: Tue Jul 08, 2008 08:47
by sipickles
I take it you would recommend dynamic linking over static?
Posted: Tue Jul 08, 2008 11:36
by sipickles
My problem is with CEGUIBase_d
Whether I use static or dynamic linking, this where the SxS error is caused. I have (temporarily) abandoned making CEGUI a dependency of my own DLL, and now link to it in the executable, just to try and find the cause of this.
Dependency walker can see the functions inside CEGUIBase_d.dll, but says:
Code: Select all
Error: The Side-by-Side configuration information for "x:\simon\dev\wc_client\trunk\client\bin\debug\CEGUIBASE_D.DLL" contains errors.
This is with DLLs built from source.
Obviously, the exe fails at run time. Save me Scriptkid!
----------------
EDIT
I should've checked the samples earlier. I can build all the VC2005 libs, DLLs and samples from source without any (major) incident.
None of the samples will work though.
So its my machine setup or something. I don't get how there can be aprobem when I am building everything from the same source
I must move on soon, either with or without CEGUI (hopefully with)
--------------
EDIT 2
I tried using CEGUIBase_d.dll from a previous project where I had built CEGUI some time ago. This WORKED! However, its dependent on d3dx9_31.dll, not d3dx9_38.dll which is my SDK.
So what is different about my setup now? It has had a reformat since. I have DXSDK June 2008 (rather than october 2007), Windows SDK (not Platform SDK - perhaps a clue?), but stil MSVC2005 as before.
Posted: Wed Jul 09, 2008 08:36
by scriptkid
Hi,
at home i will try to run some static samples again. I know i did this to test the SDK's, but there might have been DLL files in the same folder. So i will re-run the test without any DLLs in the path.
The SDKs are build with MBCS, which is the default.