Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
artieTwelve's avatar
artieTwelve
Honored Guest
10 years ago

0.6.0.0 compiling with Win32_GLAppUtils.h

I'm trying to build a few simple apps to explore the new SDK and I would like to reuse the structs found in the Win32_GLAppUtils header file. Unfortunatly, I'm getting linking errors when I try this. I've boiled one of the apps down to nothing and it still gets 12 link errors, the first of which is below. Googling tells me it's a configuration error, but for the life of me, I can't find it. If I comment out the include line, it compiles without problems. Any ideas?

Thanks.

Error:
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in DisplayMain.obj D:\OVRift6.0\Projects\OpenGLRewrite\2.3 Basic Display\LibOVRKernel.lib(CAPI_GLE.obj)


// from the Oculus Tiny Romm Advanced app
#include <Win32_GLAppUtil.h>
#include <OVR_CAPI_0_6_0.h>
#include <iostream>

int main(int argc, char* argv[])
{
std::cout << "Hello Rift" << std::endl;
// Initialize LibOVR
ovr_Initialize(nullptr);
// Initialze Rift
ovrHmd hmd = nullptr;
ovrHmd_Create(0, &hmd);
std::cout << "Goodbye Rift" << std::endl;

}

2 Replies

  • You can't really mix and match the different linkages for the C runtime library. In addition to debug and release versions of the library, there are also statically linked and dynamically linked version. 'MTd' indicated the static version, while 'MDd' indicates the dynamic version. You need to make sure that all your projects and all your libraries are built with a consistent setting.

    For MSVC, you can change the settings for something by going into the project properties under C++/Code Generation and modify the Runtime Library setting.

    If you're working with multiple upstream dependencies that are built in different ways then you're probably going to encounter this until you can rebuild some of them with a consistent setting.

    Please don't ask which is the 'right' setting to use, because there really isn't one. Which one you want depends on how you want to build and distribute your app. If you don't care about those issues right now (and if you don't know what these settings are already, you're probably not at the point where you'll care) then all you should be concerned about is getting your project to use a consistent setting.

    Bear in mind that if you have a binary library that you're linking against that uses a setting, you may have to just change everything else to match that setting, since rebuilding it will not be an option.
  • That was it. As luck would have it, the test program I was trying to compile was from your book, example 2.6., the red and blue boxes. Imagine my suprize when I saw who answered my question! My jaw pretty much hit the floor. I'm hoping there will be another MEAP update fairly soon to cover 0.6.0.0. but I can only imagine how frustrating it must be to rewrite the code every couple of months. Thanks again!