问题
I have a C++ library built using VC++ 2010. I have the headers, import libs and DLLs for this library. I want to use this library in my Windows 8 Store app that I am trying to build using VC++ 2012. My app works fine on my local machine but when I try to run this app on a remote Windows 8 device, the app fails to load. What am I doing wrong?
回答1:
You cannot use C++ binaries built using older version of Visual Studio (older than Visual Studio 2012) in your Windows 8 Store apps.
The reason for that is because a binary built using say Visual Studio 2010 will have a dependency on the C++ Runtime DLLs from Visual Studio 2010. Whereas the rest of your app is written using Visual Studio 2012 so it will have a dependency on C++ Runtime DLLs from Visual Studio 2012. The latter is made automatically available from the Windows Store (read this for more details). However the former is not available on the Windows Store. Also, there is no way for your app to express a dependency on VC2010 Runtime. Including VC2010 Runtime DLLs inside the app package will also not work since the package will be rejected at Store upload time.
Therefore the best option is to build all sources for your Windows 8 Store app strictly using Visual Studio 2012.
来源:https://stackoverflow.com/questions/14088917/using-a-c-library-built-using-visual-c-2010-in-a-windows-8-store-app-buil