Visual Studio 2012 Dynamically Linking & Statically Linking in 1 Project

closed account (N36fSL3A)
Hello, I've recently integrated a scripting functionality into my game engine (squirrel), but I can't figure out how to dynamically link the library.

I have to dynamically link some libraries for licencing sake, but I'm forced to statically link Squirrel. How can I statically link Squirrel, but dynamically link the others? Thanks in advance.
closed account (o1vk4iN6)
All you have to do is link to the .lib file, i don't think it matters if it's dynamic or static only when the program runs it will have to look for the DLL file. The only thing is when you statically link to a library I think the standard library has to be linked in the same way. So if squirrel is linking to the standard library dynamically and your project is linking statically, you'll get a bunch of linker errors.
closed account (N36fSL3A)
I honestly don't know what it's doing. All I know is that I get these errors:

1>------ Build started: Project: Caelestis Fere, Configuration: Debug Win32 ------
1>  Scripting.cpp
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\scripting.cpp(14): warning C4244: 'initializing' : conversion from 'std::streamoff' to 'CF::Uint32', possible loss of data
1>  Generating Code...
1>  Compiling...
1>  Game.cpp
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\resource manager.h(229): warning C4244: 'argument' : conversion from '__int64' to 'unsigned int', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\resource manager.h(230): warning C4244: 'argument' : conversion from '__int64' to '__w64 int', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\resource manager.h(253): warning C4244: 'argument' : conversion from '__int64' to 'unsigned int', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\resource manager.h(254): warning C4244: 'argument' : conversion from '__int64' to '__w64 int', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\resource manager.h(277): warning C4244: 'argument' : conversion from '__int64' to 'unsigned int', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\resource manager.h(278): warning C4244: 'argument' : conversion from '__int64' to '__w64 int', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\engine\core engine\audio.hpp(137): warning C4244: 'argument' : conversion from 'CF::Uint32' to 'ALfloat', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\game.cpp(219): warning C4244: 'argument' : conversion from 'unsigned int' to 'GLfloat', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\game.cpp(220): warning C4244: 'argument' : conversion from 'unsigned int' to 'GLfloat', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\game.cpp(225): warning C4244: 'argument' : conversion from 'unsigned int' to 'GLfloat', possible loss of data
1>c:\users\good\documents\visual studio 2012\projects\caelestis fere\caelestis fere\source\game.cpp(226): warning C4244: 'argument' : conversion from 'unsigned int' to 'GLfloat', possible loss of data
1>  Generating Code...
1>squirrel.lib(sqapi.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqmem.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqobject.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqstate.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqvm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqdebug.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqtable.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqcompiler.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqclass.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqbaselib.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqfuncstate.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>squirrel.lib(sqlexer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Audio.obj
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Good\documents\visual studio 2012\Projects\Caelestis Fere\Debug\Caelestis Fere.exe : fatal error LNK1319: 12 mismatches detected
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited on
closed account (oGbjE3v7)
Looks like you are using dynamic linking and squirrel is using static:

http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
closed account (N36fSL3A)
I know, I'm trying to figure a way to build it into a .dll. I'm unsure on how to do this.
Compile squirrel or whatever using /MDd switch for debug and /MTd for release.

However, this will only make a difference as your executable will depend on msvcr110.dll and msvcp110.dll or not, this will NOT compile squirrel as a static library automatically.
Last edited on
closed account (N36fSL3A)
Never mind guys I fixed it, I asked the question on their forums and the creator responded and immediately fixed my problem.
Could you post the solution in case anyone with the same issue finds this thread?
closed account (N36fSL3A)
Oh yea, I just changed the project settings on the library solution to the ones on my game engine solution and recompiled.
Topic archived. No new replies allowed.