[SOLVED] LNK2001: Can't createWindow in MSVC++2008

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

knight666
Just popping in
Just popping in
Posts: 7
Joined: Sat Jul 18, 2009 21:36

[SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby knight666 » Sat Jul 18, 2009 21:38

Hello,

I'm trying to convert an open source project from a build based on Code::Blocks to MSVC++ 9, and I'm running into a bit of trouble. No matter what I link, I get the following linker errors:

Code: Select all

chara_menu.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class CEGUI::Window * __thiscall CEGUI::WindowManager::createWindow(class CEGUI::String const &,class CEGUI::String const &,class CEGUI::String const &)" (__imp_?createWindow@WindowManager@CEGUI@@QAEPAVWindow@2@ABVString@2@00@Z)


These are my settings:

Linker->General->Additional Library Directories
"$(InputDir)\lib"
"$(OGRE_HOME)\lib"

Linker->Input->Additional Dependencies:
OgreMain.lib
CEGUIBase.lib
OgreGUIRenderer.lib
OIS.lib
OpenAL32.lib
ogg.lib
vorbis.lib
vorbisfile.lib
vorbisenc.lib
glut.lib
glut32.lib
alut.lib

C/C++->Additional Include Directories:
include
include\CEGUI
include\al
include\boost
include\ogg
include\vorbis
$(OGRE_HOME)\include
$(OGRE_HOME)\samples\include
$(OGRE_HOME)\include\OIS
F:\Programs\DirectX\Include

Any help would be appreciated.
Last edited by knight666 on Sun Jul 19, 2009 12:19, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: LNK2001: Can't createWindow in MSVC++2008

Postby CrazyEddie » Sun Jul 19, 2009 09:10

These errors are usually caused a mismatch between the headers used for compiling and the libs used for linking. More specifically, in this case it looks like a 0.6.x header was used, but the library (CEGUIBase(_d).lib) is either from 0.5.x (or earlier) or from current svn trunk ;)

HTH

CE.

knight666
Just popping in
Just popping in
Posts: 7
Joined: Sat Jul 18, 2009 21:36

Re: LNK2001: Can't createWindow in MSVC++2008

Postby knight666 » Sun Jul 19, 2009 09:20

You were right! :D

I spent six hours yesterday trying to get it to compile, and you fixed it in five seconds. :P

I now have a brand new DLL error though:

Image

And copying the 0.6.2 DLL's didn't work. :(

knight666
Just popping in
Just popping in
Posts: 7
Joined: Sat Jul 18, 2009 21:36

Re: LNK2001: Can't createWindow in MSVC++2008

Postby knight666 » Sun Jul 19, 2009 10:59

Okay, I found http://www.cegui.org.uk/phpBB2/viewtopic.php?p=17027#p17027 this post, and that solved a lot of linker errors, but I still have library errors. :(

I recompiled OgreGUIRenderer_d.[lib/dll] and OgreMain_d.[lib/dll], but I still get an error in OgreMain_d.dll:

Image

knight666
Just popping in
Just popping in
Posts: 7
Joined: Sat Jul 18, 2009 21:36

Re: LNK2001: Can't createWindow in MSVC++2008

Postby knight666 » Sun Jul 19, 2009 12:19

Fixed it. :)

The clue was in the ogre.log, it was complaining it couldn't load some plugin dll's.
Recompiled those (RenderSystem_Direct3D9_d.dll, Plugin_ParticleFX_d.dll, Plugin_BSPSceneManager_d.dll, Plugin_OctreeSceneManager_d.dll, Plugin_CgProgramManager_d.dll) and now it loads! >^_^<

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby CrazyEddie » Mon Jul 20, 2009 08:23

Hehe, when in doubt, rebuild everything ;) I'm glad you got it working.

CE.

raymccooney
Just popping in
Just popping in
Posts: 11
Joined: Sat Jul 18, 2009 23:43

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby raymccooney » Sun Aug 09, 2009 19:19

Hi Eddie

I have a similar problem, maybe you know what that might be?

I'm currently using cegui which comes shipped with the Ogre 1.6.2 SDK, so the necessary dll's and lib's are available in the SDK directory.
However, the lua scripting module is not precompiled, so i downloaded the newest precompiled cegui sdk (CEGUI-SDK-0.6.2-vc9) as I couldn't get the SVN version to work due to premake.exe problems.

When linking against the new library files in the cegui sdk's lib directory, I get an error that the application couldn't find the function ScriptException inside the dll CEGUIBase_d.dll, so I copied all dll's from the new cegui sdk bin's directory and tried again: Now he can't find InvalidRequestException.

Any ideas? I intend not to recompile everything if possible...

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby CrazyEddie » Mon Aug 10, 2009 08:29

I'm currently using cegui which comes shipped with the Ogre 1.6.2 SDK

I'm not 100% sure which that is, bit I think it's a 0.5.x based release.

I couldn't get the SVN version to work due to premake.exe problems.

When you say SVN I'm uncertain as to whether you mean the trunk code or the stable 'cegui_mk2/branches/v0-6' code. Our premake scripts are only working with premake 3.6 at the moment, I should get around to updating the trunk versions to work with premake 4 prior to the CEGUI 0.7.0 release. The stable v0-6 code is recommended over any other at the moment due to it having some important fixes to the binary 0.6.2b release.

When linking against the new library files in the cegui sdk's lib directory, I get an error that the application couldn't find the function ScriptException inside the dll CEGUIBase_d.dll, so I copied all dll's from the new cegui sdk bin's directory and tried again: Now he can't find InvalidRequestException.

This happens when the various components; headers, import libraries and DLLs are in some way mismatched. Also, in order to use the updated 0.6.2b binaries, you must recompile (at least) the OgreCEGUIRenderer module from the Ogre source.

If all you want/need is the scripting module, you could grab the one from the last 0.5.x SDK release and it should work. If you're looking to upgrade to 0.6.x for other reasons also, then there's a recipe on the forums for the right way to go about that :)

HTH

CE.

raymccooney
Just popping in
Just popping in
Posts: 11
Joined: Sat Jul 18, 2009 23:43

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby raymccooney » Mon Aug 10, 2009 09:47

Hi Eddie, thanks for your quick reply!

As I only need the Scripting Module, the last possibility seems to be the most reasonable for me. But how do I detect which 0.5.X release I need to take? Does it even matter? Do you think the 0.5.0 final release could possibly work with the Ogre SDK?

NB: I've just upgraded to Ogre 1.6.3 Shoggoth :wink:

Thank you very much for your helping!

Ray McCooney

EDIT: Just got it to work with 0.5.0 final release, thank you eddie!

raymccooney
Just popping in
Just popping in
Posts: 11
Joined: Sat Jul 18, 2009 23:43

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby raymccooney » Wed Aug 12, 2009 09:22

Hi Eddie,

Sorry to bother you again, but I still don't get it running, I'm absolutely clueless... :cry:
Here's what I've done:

1) Downloaded the newest Ogre 1.6.3 sourcecode via SVN and recompiled OgreMain and OgreCEGUIRenderer. I copied the resulted dll's to my executables directory
2) SVN checkouted the stable v0-6 cegui code. Compiled everything and copied the resulted dll's to my executables directory (One of these dll's is CEGUIBase_d.dll)
3) Recompiled my application and adjusted linking paths to the new libraries from step 1 and 2
4) Tried to run: Same error: Can't find InvalidRequestException in CEGUIBase_d.dll.

The funny thing is that when I copy the CEGUIBase_d.dll from the OgreSDK 1.6.3 SDK (precompiled version), I get a different error (a latter error, because other libraries are loaded first). So I checked all my linker and include directories again again and again, but I can't spot the error. I even tried to swap the linker and include order to resolve possible interferences.

Maybe I'm doing something completely wrong? The only possible error I can spot is that I had to download the Cegui 0.6 precompiled dependencies because they were not in the SVN trunk of the v0-6 cegui code.

My applications' include directories:

Code: Select all

"v0-6\ScriptingModules\CEGUILua\tolua++"
"v0-6\ScriptingModules\CEGUILua\LuaScriptModule\include"
"v0-6\include"
"v0-6\dependencies\include"
"Ogre-v1-6\Samples\Common\CEGUIRenderer\include"
include
"Ogre-v1-6\include"
"..\Hydrax-v0.5\Hydrax\src\Hydrax"


My applications' lib directories:

Code: Select all

"..\CEGUI-SDK-0.6.2\lib"
..\..\bin\debug
"Ogre-v1-6\lib"


Libs:

Code: Select all

Ws2_32.lib
Hydrax.lib
OgreGUIRenderer_d.lib
OgreMain_d.lib
OIS_d.lib
CEGUIBase_d.lib
tolua++_d.lib
CEGUILua_d.lib

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby CrazyEddie » Wed Aug 12, 2009 18:10

Yeah, you're doings it wrong :lol:

The correct sequence is posted here: viewtopic.php?f=10&t=3230 step 4 is key - get that bit wrong and you'll have no end of issues.

CE.

raymccooney
Just popping in
Just popping in
Posts: 11
Joined: Sat Jul 18, 2009 23:43

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby raymccooney » Wed Aug 12, 2009 20:08

Hi Eddie, thank you very much - it indeed was the problem, you are my new hero ;) 9 Hours debugging and the solution would have been so easy :cry: :cry: :cry:

Anyways, do you by chance know why Ogre still sticks to Cegui 0.5? Or when they ship cegui, why they don't ship the scripting modules as well?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [SOLVED] LNK2001: Can't createWindow in MSVC++2008

Postby CrazyEddie » Thu Aug 13, 2009 08:36

raymccooney wrote: do you by chance know why Ogre still sticks to Cegui 0.5? Or when they ship cegui, why they don't ship the scripting modules as well?

I believe the 0.5.x version still being in use is mainly an inertia / time issue; the 0.5 version in use does what is needed - the UI parts of the Ogre samples - so there's no great rush to upgrade it (even if it is ancient and has many bugs!). The reasoning for not providing the 'full' CEGUI package (script modules, alternate XML parser modules, etc) is also pretty much the same; they're only providing those parts required to do what they need in the samples.

I guess if I had to provide some additional rationale behind those decisions I would say it's because - 9 hours of debugging aside - it's relatively painless to do the upgrade where people feel that it's necessary. Though I don't speak for Sinbad or the other Ogre devs, so for a definitive answer you should ask them :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests