[Solved] Error Linking Ogre to application in VS2017

Problems building or running the engine, queries about how to use features etc.
Post Reply
rtalbutt
Gnoblar
Posts: 2
Joined: Sat Jul 01, 2017 4:26 pm

[Solved] Error Linking Ogre to application in VS2017

Post by rtalbutt »

I am getting the following error when linking Ogre 2.1 to my application in VS2017.

Code: Select all

Error	LNK2019	unresolved external symbol "__declspec(dllimport) public: static void * __cdecl Ogre::AllocatedObject<class Ogre::CategorisedAlignAllocPolicy<5,0> >::operator new(unsigned __int64)" (__imp_??2?$AllocatedObject@V?$CategorisedAlignAllocPolicy@$04$0A@@Ogre@@@Ogre@@SAPEAX_K@Z) referenced in function "public: __cdecl Etrium::Game::Game(void)" (??0Game@Etrium@@QEAA@XZ)	Ape2	L:\Source\ape\bin\Game.obj	1	
Error	LNK1120	1 unresolved externals	Ape2	L:\Source\ape\bin\Debug\Ape2.exe	1	
OgreMain is being linked to my app, If I take it out I then get 77 unresolved external symbols. It seems to be just this one symbol that is missing. Has anyone seen anything similar.

Ogre was compiled without errors using CMAKE.
Last edited by rtalbutt on Sun Jul 02, 2017 11:16 pm, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

Re: Error Linking Ogre to application in VS2017

Post by dark_sylinc »

Just one symbol is the first time I see.
Do the samples work correctly?

Are you able to post what's inside Etrium::Game::Game ?
fenriss
Gold Sponsor
Gold Sponsor
Posts: 25
Joined: Mon Oct 03, 2016 7:36 pm
x 2

Re: Error Linking Ogre to application in VS2017

Post by fenriss »

Ogre does export that instantiation in OgreMain\src\OgreMemoryAllocatedObject.cpp (template class AllocatedObject<ResourceAllocPolicy>;)
I have this export in OgreMain.dll in vs2017:
debug: ??2?$AllocatedObject@V?$CategorisedAlignAllocPolicy@$04$0A@@Ogre@@@Ogre@@SAPEAX_KPEBDH1@Z
release: ??2?$AllocatedObject@V?$CategorisedAlignAllocPolicy@$04$0A@@Ogre@@@Ogre@@SAPEAX_K@Z
Are you linking the with some old paths?
rtalbutt
Gnoblar
Posts: 2
Joined: Sat Jul 01, 2017 4:26 pm

Re: Error Linking Ogre to application in VS2017

Post by rtalbutt »

I have found the problem. In my code I was using "new" instead of "OGRE_NEW" to instantiate "HlmsUnlit".

Strangely this works OK when compiling and running under Linux thus we have not spotted it before.
Post Reply