创建 64 位 CLR C++ VS2008中的项目
我正在围绕本机库创建一个包装器,它有 32 和 32 两种版本。 64 位口味。我有一个相当复杂的 C++/CLR 项目,其中包含许多来自本机库的头文件。我让它在 x32 上运行良好,但现在我不确定如何提供替代的 x64 版本。
有人可以概述创建此类项目的步骤吗?
- 各种定义依赖于_WIN32 / _WIN64,所以必须是多个项目吗?
- x32/x64 本机库具有相同的文件名。目前,lib 引用是通过
#pragma comment (lib, "xxxxxx.lib")
完成的。这应该如何改变呢?
最后 - VS2008 仅列出了 Win32 平台,而不列出了 Win64(我确实安装了 x64 VS2008 组件)。
谢谢!
I am creating a wrapper around a native lib, which comes in both 32 & 64 bit flavors. I have a fairly complex C++/CLR project that includes a number of header files from the native libs. I got it to work fine on x32, but now I'm not sure how to provide an alternative x64 build.
Can someone outline the steps to create such project?
- Various defines depend on _WIN32 / _WIN64, so must be multiple projects?
- Both x32/x64 native libs have identical file names. Currently the lib ref is done with
#pragma comment (lib, "xxxxxx.lib")
. How should this be changed?
Lastly - VS2008 has only Win32 platform listed, not Win64 (I do have x64 VS2008 component installed).
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,选择显示 win32 的下拉菜单(工具栏上“调试/发布”旁边)并选择“配置管理器”就足够了。然后打开“Active Solution Platform”下拉列表并选择“新建”。选择 x64 类型(如果不存在,则不会安装 64 位编译器)并从原始 Win32 类型复制解决方案。现在,您可以通过更改工具栏上的下拉菜单来选择性地构建您的项目。
通常它或多或少按原样工作,但如果仅用于智能感知,您可能需要考虑调整一些预处理器定义。
至于库,对于平台库(作为 VS/PSDK 的一部分提供),那么您不需要更改任何内容。对于您要包装的库,然后将项目属性中的附加库目录更改为指向 64 位目录。
Normally it is sufficient to select the drop down which says win32 (next to the Debug/Release one on the toolbar) and selected "Configuration Manager". Then open the "Active Solution Platform" drop down and select New. Choose x64 type (which if it doesn't exist then 64bit compilers are not installed) and copy solution from the orignal Win32 one. Now your project can be built selectively by changing the drop down on the toolbar.
Normally it works more or less as is but you might want to consider tweaking a few pre-processor defines if only for the intellisense.
As for libraries, for platform ones (supplied as part of VS/PSDK) then you dont need to change anything. For your libraries you are wrapping then change the Additional Library Directories in the project properties to point to the 64bit directory.
Visual Studio 并不总是安装 64 位选项。
可以通过运行 VS 安装程序、选择添加/删除功能并检查 x64 功能来修复它。
Visual studio doesn't always install the 64 bit options.
It can be fixed by running the VS installer, choosing add/remove features, and checking the x64 feature.