static linking issues
Posted: Sun Mar 21, 2010 00:50
I did a search and found some stuff but couldn't figure out what is happening.
First off I got CEGUI working with the engine I'm using via the dll's. All that worked great. So now I'm trying to statically link to remove all those nasty dll's. I do have CEGUI_STATIC defined as well:
Here are the files I'm linking to on the Release build:
So I basically took the dll names that I was using and linked the _Static and \static\ libraries. So with the non static libraries of the above and having the dll's it worked. Changing to the static libraries and removing the dll's I'm getting the following linker errors.
First off I got CEGUI working with the engine I'm using via the dll's. All that worked great. So now I'm trying to statically link to remove all those nasty dll's. I do have CEGUI_STATIC defined as well:
Code: Select all
#define CEGUI_STATIC
#include "CEGUI.h"
#include "CEGUIOpenGLRenderer.h"
#include "CEGUIDefaultResourceProvider.h"
Here are the files I'm linking to on the Release build:
Code: Select all
C:\CEGUI-SDK-0.7.1-vc9\lib\CEGUIBase_Static.lib
C:\CEGUI-SDK-0.7.1-vc9\lib\CEGUIOpenGLRenderer_Static.lib
C:\CEGUI-SDK-0.7.1-vc9\lib\CEGUIXercesParser_Static.lib
C:\CEGUI-SDK-0.7.1-vc9\lib\CEGUIExpatParser_Static.lib
C:\CEGUI-SDK-0.7.1-vc9\lib\CEGUIFalagardWRBase_Static.lib
C:\CEGUI-SDK-0.7.1-vc9\lib\CEGUISILLYImageCodec_Static.lib
C:\CEGUI-SDK-0.7.1-vc9\dependencies\lib\static\SILLY.lib
C:\CEGUI-SDK-0.7.1-vc9\dependencies\lib\static\xerces-c_static_3.lib
Opengl32.lib
So I basically took the dll names that I was using and linked the _Static and \static\ libraries. So with the non static libraries of the above and having the dll's it worked. Changing to the static libraries and removing the dll's I'm getting the following linker errors.
Code: Select all
1>------ Build started: Project: CEGUITest, Configuration: Release Win32 ------
1>Linking...
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "protected: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Myptr(void)const " (?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IBEPBDXZ) already defined in CEGUIBase_Static.lib(CEGUIString.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in CEGUIBase_Static.lib(CEGUIString.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in CEGUIBase_Static.lib(CEGUIString.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in CEGUIBase_Static.lib(CEGUIString.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in CEGUIBase_Static.lib(CEGUIString.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in CEGUIBase_Static.lib(CEGUIWindowManager.obj)
1>libcpmt.lib(locale0.obj) : error LNK2005: "void __cdecl _AtModuleExit(void (__cdecl*)(void))" (?_AtModuleExit@@YAXP6AXXZ@Z) already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: __Fac_tidy already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static void __cdecl std::locale::facet::facet_Register(class std::locale::facet *)" (?facet_Register@facet@locale@std@@CAXPAV123@@Z) already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(ios.obj) : error LNK2005: "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd@ios_base@std@@SAXPAV12@@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(ios.obj) : error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP90.dll)
1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(setlocal.obj) : error LNK2005: _setlocale already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter_noinfo already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(lconv.obj) : error LNK2005: _localeconv already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRT.lib(crtexe.obj)
1>LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(_ctype.obj) : error LNK2005: _isspace already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(strtol.obj) : error LNK2005: _strtol already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMT.lib(strtol.obj) : error LNK2005: _strtoul already defined in MSVCRT.lib(MSVCR90.dll)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>CEGUIBase_Static.lib(CEGUISystem.obj) : error LNK2001: unresolved external symbol __imp__timeGetTime@0
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Load_Char
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Done_Face
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Get_Next_Char
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Get_First_Char
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Set_Char_Size
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_New_Memory_Face
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Init_FreeType
1>CEGUIBase_Static.lib(CEGUIFreeTypeFont.obj) : error LNK2001: unresolved external symbol _FT_Done_FreeType
1>CEGUIBase_Static.lib(CEGUIPCRERegexMatcher.obj) : error LNK2001: unresolved external symbol _pcre_free
1>CEGUIBase_Static.lib(CEGUIPCRERegexMatcher.obj) : error LNK2001: unresolved external symbol _pcre_exec
1>CEGUIBase_Static.lib(CEGUIPCRERegexMatcher.obj) : error LNK2001: unresolved external symbol _pcre_compile
1>CEGUIOpenGLRenderer_Static.lib(CEGUIOpenGLRenderTarget.obj) : error LNK2001: unresolved external symbol _gluProject@48
1>CEGUIOpenGLRenderer_Static.lib(CEGUIOpenGLRenderTarget.obj) : error LNK2001: unresolved external symbol _gluUnProject@48
1>CEGUIOpenGLRenderer_Static.lib(CEGUIOpenGLRenderTarget.obj) : error LNK2001: unresolved external symbol _gluLookAt@72
1>CEGUIOpenGLRenderer_Static.lib(CEGUIOpenGLRenderTarget.obj) : error LNK2001: unresolved external symbol _gluPerspective@32
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_error
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_get_io_ptr
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_get_channels
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_get_bit_depth
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_read_png
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_set_read_fn
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_set_error_fn
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_create_info_struct
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_create_read_struct
1>SILLY.lib(SILLYPNGImageLoader.obj) : error LNK2001: unresolved external symbol _png_get_rows
1>SILLY.lib(SILLYJPGImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_finish_decompress
1>SILLY.lib(SILLYJPGImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_start_decompress
1>SILLY.lib(SILLYJPGImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_read_header
1>SILLY.lib(SILLYJPGImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_read_scanlines
1>SILLY.lib(SILLYPNGImageContext.obj) : error LNK2001: unresolved external symbol _png_destroy_read_struct
1>SILLY.lib(SILLYPNGImageContext.obj) : error LNK2001: unresolved external symbol _png_get_image_height
1>SILLY.lib(SILLYPNGImageContext.obj) : error LNK2001: unresolved external symbol _png_get_image_width
1>SILLY.lib(SILLYJPGImageContext.obj) : error LNK2001: unresolved external symbol _jpeg_std_error
1>SILLY.lib(SILLYJPGImageContext.obj) : error LNK2001: unresolved external symbol _jpeg_CreateDecompress
1>SILLY.lib(SILLYJPGImageContext.obj) : error LNK2001: unresolved external symbol _jpeg_resync_to_restart
1>SILLY.lib(SILLYJPGImageContext.obj) : error LNK2001: unresolved external symbol _jpeg_destroy_decompress
1>.\CEGUITest-Release.exe : fatal error LNK1120: 37 unresolved externals
1>Build log was saved at "file://c:\CEGUITest\Release\BuildLog.htm"
1>CEGUITest - 82 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========\