LinkageError in Visual Studio 2008

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
peerLAN
Space Krill
Posts: 9
Joined: Tue Apr 21, 2009 11:11 pm

LinkageError in Visual Studio 2008

#1 Post by peerLAN »

I'm sorry if I forgot something but I get two unresolved external linkage errors when building freeorion.

I downloaded the SDK from sourceforge, installed Python v2.5 with scons 1.2.0, and updated to last SVN version. Started building the projects (freeorion,freeorionca,freeoriond,GiGi,GiGiOgre,GiGiOgrePlugin_OSI). Every one worked well and built fine, except freeorion who has this two errors.

Code: Select all

	

Linking...
   Creating library ../../../freeorion.lib and object ../../../freeorion.exp
ClientUI.obj : error LNK2019: unresolved external symbol "public: __thiscall GG::detail::FTFaceWrapper::~FTFaceWrapper(void)" (??1FTFaceWrapper@detail@GG@@QAE@XZ) referenced in function "public: __thiscall GG::Font::Font > >(class std::basic_string,class std::allocator > const &,unsigned int,class std::vector > const &,class std::_Vector_const_iterator >,class std::_Vector_const_iterator >)" (??$?0V?$_Vector_const_iterator@UUnicodeCharset@GG@@V?$allocator@UUnicodeCharset@GG@@@std@@@std@@@Font@GG@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABV?$vector@EV?$allocator@E@std@@@3@V?$_Vector_const_iterator@UUnicodeCharset@GG@@V?$allocator@UUnicodeCharset@GG@@@std@@@3@2@Z)

ClientUI.obj : error LNK2019: unresolved external symbol "public: __thiscall GG::detail::FTFaceWrapper::FTFaceWrapper(void)" (??0FTFaceWrapper@detail@GG@@QAE@XZ) referenced in function "public: __thiscall GG::Font::Font > >(class std::basic_string,class std::allocator > const &,unsigned int,class std::vector > const &,class std::_Vector_const_iterator >,class std::_Vector_const_iterator >)" (??$?0V?$_Vector_const_iterator@UUnicodeCharset@GG@@V?$allocator@UUnicodeCharset@GG@@@std@@@std@@@Font@GG@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABV?$vector@EV?$allocator@E@std@@@3@V?$_Vector_const_iterator@UUnicodeCharset@GG@@V?$allocator@UUnicodeCharset@GG@@@std@@@3@2@Z)
../../../freeorion.exe : fatal error LNK1120: 2 unresolved externals
I think the FTFaceWrapper is the one from E:\FreeOrion_SDK\FreeOrion\GG\GG\Font.h and E:\FreeOrion_SDK\FreeOrion\GG\GG\Font.cpp

Have I forgot something in my hurry...? I don't see clear why it has the error... I have the GiGi.lib and GiGiOgre.lib made. Anyone has a solution to this, thank you!
Last edited by peerLAN on Sun Apr 26, 2009 2:16 am, edited 1 time in total.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: LinkageError in Visual Studio 2008

#2 Post by Geoff the Medio »

The latest changes to GiGi missed declaring FTFaceWrapper with the appropriate API macro.

Make this change:

Code: Select all

Index: Font.h
===================================================================
--- Font.h	(revision 726)
+++ Font.h	(working copy)
@@ -692,7 +692,7 @@
             { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(std::string); }
     };
 
-    struct FTFaceWrapper
+    struct GG_API FTFaceWrapper
     {
         FTFaceWrapper();
         ~FTFaceWrapper();
[edit]
I downloaded the SDK from softpedia
You should alwasy get the SDK from sourceforge. We don't have control over external sites, and they may not have updated their copy. If things run fine after compiling, it's probably fine, but if you get crashes or missing DLL errors, get the version here[/edit]

peerLAN
Space Krill
Posts: 9
Joined: Tue Apr 21, 2009 11:11 pm

Re: LinkageError in Visual Studio 2008

#3 Post by peerLAN »

Yes, all green for go! It builds now with no errors. But unfortunately when I run it I get

Code: Select all

main() caught exception std::runtime_error): Failed to find an Ogre GL render system.


with ogre.log being :

Code: Select all

05:23:27: Creating resource group General
05:23:27: Creating resource group Internal
05:23:27: Creating resource group Autodetect
05:23:27: SceneManagerFactory for type 'DefaultSceneManager' registered.
05:23:27: Registering ResourceManager for type Material
05:23:27: Registering ResourceManager for type Mesh
05:23:27: Registering ResourceManager for type Skeleton
05:23:27: MovableObjectFactory for type 'ParticleSystem' registered.
05:23:27: OverlayElementFactory for type Panel registered.
05:23:27: OverlayElementFactory for type BorderPanel registered.
05:23:27: OverlayElementFactory for type TextArea registered.
05:23:27: Registering ResourceManager for type Font
05:23:27: ArchiveFactory for archive type FileSystem registered.
05:23:27: ArchiveFactory for archive type Zip registered.
05:23:27: FreeImage version: 3.10.0
05:23:27: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
05:23:27: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
05:23:27: DDS codec registering
05:23:27: Registering ResourceManager for type HighLevelGpuProgram
05:23:27: Registering ResourceManager for type Compositor
05:23:27: MovableObjectFactory for type 'Entity' registered.
05:23:27: MovableObjectFactory for type 'Light' registered.
05:23:27: MovableObjectFactory for type 'BillboardSet' registered.
05:23:27: MovableObjectFactory for type 'ManualObject' registered.
05:23:27: MovableObjectFactory for type 'BillboardChain' registered.
05:23:27: MovableObjectFactory for type 'RibbonTrail' registered.
05:23:27: OGRE EXCEPTION(6:FileNotFoundException): 'ogre_plugins.cfg' file not found! in ConfigFile::load at ..\src\OgreConfigFile.cpp (line 84)
05:23:27: ogre_plugins.cfg not found, automatic plugin loading disabled.
05:23:27: *-*-* OGRE Initialising
05:23:27: *-*-* Version 1.6.1 (Shoggoth)
05:23:27: *-*-* OGRE Shutdown
05:23:27: Unregistering ResourceManager for type Compositor
05:23:27: Unregistering ResourceManager for type Font
05:23:27: Unregistering ResourceManager for type Skeleton
05:23:27: Unregistering ResourceManager for type Mesh
05:23:27: Unregistering ResourceManager for type HighLevelGpuProgram
05:23:27: Unregistering ResourceManager for type Material
Edit: Sorry about that typo, I meant sourceforge.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: LinkageError in Visual Studio 2008

#4 Post by Geoff the Medio »

How do you run it, and do you have an ogre_plugins.cfg file in your FreeOrion directory?

If you're using the run button in the MSVC GUI, you may need to fiddle with the working directory it launches in, so that it's running from where the executables are and where ogre_plugins.cfg is. Alternatively, you can just run it from the command line, which I usually do to ensure any debug output sticks around after exiting.

If you don't have an ogre_plugins.cfg, you should. It's in SVN.

peerLAN
Space Krill
Posts: 9
Joined: Tue Apr 21, 2009 11:11 pm

Re: LinkageError in Visual Studio 2008

#5 Post by peerLAN »

You are right :mrgreen: . I went to Properties > Configuration Properties > Debugging > Working Directory and changed it to FreeOrion_SDK\FreeOrion and it now works :P (I mention it just in case someone else will read this).

I'll go to sleep now as it's got quite late (building it take quite a chunk of time...), I'll have some fun looking inside tomorrow :D

Cheers, and thank you for the quality support.

P.S. The SDK really streamlined and simplified the work a lot, great stuff.

D.B.Thumbs
Space Krill
Posts: 2
Joined: Fri May 29, 2009 5:43 pm
Location: Russia

Re: LinkageError in Visual Studio 2008

#6 Post by D.B.Thumbs »

Today I compiled the code and get these errors (on freeorionca and freeoriond):

Code: Select all

1>XMLDoc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall GG::ExceptionBase::ExceptionBase(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0ExceptionBase@GG@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall XMLElement::Exception::Exception(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Exception@XMLElement@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>XMLDoc.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall GG::ExceptionBase::what(void)const " (?what@ExceptionBase@GG@@UBEPBDXZ)
1>XMLDoc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall GG::ExceptionBase::~ExceptionBase(void)" (__imp_??1ExceptionBase@GG@@UAE@XZ) referenced in function "public: virtual __thiscall XMLElement::Exception::~Exception(void)" (??1Exception@XMLElement@@UAE@XZ)
1>XMLDoc.obj : error LNK2001: unresolved external symbol "public: __thiscall GG::ExceptionBase::ExceptionBase(class GG::ExceptionBase const &)" (??0ExceptionBase@GG@@QAE@ABV01@@Z)
1>XMLDoc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall GG::ExceptionBase::ExceptionBase(class GG::ExceptionBase const &)" (__imp_??0ExceptionBase@GG@@QAE@ABV01@@Z) referenced in function "public: __thiscall XMLElement::Exception::Exception(class XMLElement::Exception const &)" (??0Exception@XMLElement@@QAE@ABV01@@Z)
1>PtRect.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl GG::operator<(struct GG::Pt const &,struct GG::Pt const &)" (__imp_??MGG@@YA_NABUPt@0@0@Z) referenced in function "public: bool __thiscall GG::Rect::Contains(struct GG::Pt const &)const " (?Contains@Rect@GG@@QBE_NABUPt@2@@Z)
1>PtRect.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl GG::operator<=(struct GG::Pt const &,struct GG::Pt const &)" (__imp_??NGG@@YA_NABUPt@0@0@Z) referenced in function "public: bool __thiscall GG::Rect::Contains(struct GG::Pt const &)const " (?Contains@Rect@GG@@QBE_NABUPt@2@@Z)

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: LinkageError in Visual Studio 2008

#7 Post by Geoff the Medio »

Looks like I forgot to commit some changes to those project files. I'll see about fixing that momentarily...

Edit: Done. See if revision 3105 fixes things.

D.B.Thumbs
Space Krill
Posts: 2
Joined: Fri May 29, 2009 5:43 pm
Location: Russia

Re: LinkageError in Visual Studio 2008

#8 Post by D.B.Thumbs »

Yes! Working now.

Post Reply