如何构建 64 位托管 c++ Visual Studio 2010 中的 dll 吗?

发布于 2024-12-29 21:42:55 字数 152 浏览 1 评论 0原文

我有一个托管的 c++ dll,它以 x86 格式构建得很好。但是,当我在配置管理器中将格式更改为 x64 时,它无法识别 .Net 命名空间,例如系统等。

我还应该更改什么才能构建 64 位版本的应用程序?

我需要能够为 x64 和 x86 构建应用程序。

I've got a managed c++ dll, and it builds fine in x86 format. However, when I change the format to x64 in configuration manager, it won't recognize .Net namespaces, like System etc.

What else should I change to be able to build the 64-bit version of the app?

I'll need to be able to build the app for x64 and for x86.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

jJeQQOZ5 2025-01-05 21:42:55

当您将项目更改为目标 x64 时,告诉编译器以 .NET Framework 为目标的设置显然没有被转移。

检查项目的属性以确保所有 x64 设置与 x86 设置匹配。

更具体地说,您正在寻找“公共语言运行时支持”属性。在最新版本的 Visual Studio 上,对于托管 C++,这可能应设置为公共语言运行时支持、旧语法 (/clr:oldSyntax)

When you changed your project to target x64, the settings that tell the compiler to target the .NET Framework obviously didn't get transferred over.

Check your project's properties to ensure that all of the x64 settings match with the x86 settings.

More specifically, you're looking for the "Common Language Runtime Support" property. On recent versions of Visual Studio, this should probably be set to Common Language Runtime Support, Old Syntax (/clr:oldSyntax) for Managed C++.

  

旧城烟雨 2025-01-05 21:42:55

您将创建一个“x64”配置,其中有第二个下拉框用于“复制设置”。还必须正确设置以从其他配置复制设置。

但既然您已经这样做了,也许您所有的程序集引用都没有复制到您的“x64”配置中。您是否检查过 x64 项目设置以查看它们是否存在?打开您的项目设置并选择:
公共属性->框架和参考文献
然后确保您(至少)有对系统的引用

You would create an 'x64' configuration there is a second drop down box for 'copy settings from'. That also has to be properly set to copy setting from your other configurations.

But since you have already done that, perhaps all your assembly referenences didn't copied over to your 'x64' configuration. Have you checked in your x64 project settings to see if they are there? Open up your project settings and select:
Common Properties -> Framework and References
Then make sure you have a reference to System (At least)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文