在 Windows 8 应用商店应用程序(使用 Visual C++ 2012 构建)中使用 C++ 库(使用 Visual C++ 2010 构建) [英] Using a C++ Library (built using Visual C++ 2010) in a Windows 8 Store app (built using Visual C++ 2012)

查看:42
本文介绍了在 Windows 8 应用商店应用程序(使用 Visual C++ 2012 构建)中使用 C++ 库(使用 Visual C++ 2010 构建)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 VC++ 2010 构建的 C++ 库.我有这个库的头文件、导入库和 DLL.我想在我尝试使用 VC++ 2012 构建的 Windows 8 Store 应用程序中使用这个库.我的应用程序在我的本地机器上运行良好,但是当我尝试在远程 Windows 8 设备上运行这个应用程序时,该应用程序无法加载.我做错了什么?

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?

推荐答案

您不能在 Windows 8 应用商店应用中使用使用旧版 Visual Studio(早于 Visual Studio 2012)构建的 C++ 二进制文件.

You cannot use C++ binaries built using older version of Visual Studio (older than Visual Studio 2012) in your Windows 8 Store apps.

这样做的原因是因为使用 Visual Studio 2010 构建的二进制文件将依赖于来自 Visual Studio 2010 的 C++ 运行时 DLL.而您的应用程序的其余部分是使用 Visual Studio 2012 编写的,因此它将依赖于Visual Studio 2012 中的 C++ 运行时 DLL.后者可从 Windows 应用商店自动获取(阅读 this 了解更多详情).但是,前者在 Windows 应用商店中不可用.此外,您的应用程序无法表达对 VC2010 运行时的依赖.在应用包中包含 VC2010 运行时 DLL 也将不起作用,因为该包将在商店上传时被拒绝.

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.

因此,最好的选择是严格使用 Visual Studio 2012 为您的 Windows 8 应用商店应用构建所有源.

Therefore the best option is to build all sources for your Windows 8 Store app strictly using Visual Studio 2012.

这篇关于在 Windows 8 应用商店应用程序(使用 Visual C++ 2012 构建)中使用 C++ 库(使用 Visual C++ 2010 构建)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆