“目标机器"的目的Visual Studio 中的字段 ->链接器->高级选项->目标机器 [英] Purpose of "Target machine" field in Visual studio -> Linker-> Advanced Options->Target Machine

查看:29
本文介绍了“目标机器"的目的Visual Studio 中的字段 ->链接器->高级选项->目标机器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 32 位 C++ 应用程序移植到 64 位(使用 VS2008).我不确定这个字段在 VS2008 中是什么意思 ::

I'm porting a 32-bit C++ app to 64-bit (using VS2008). I'm not sure what does this field mean in the VS2008 ::

Visual studio ->Configuration Properties-> Linker-> Advanced Options->Target Machine.

默认情况下,它的值设置为未设置".如果我想将我的应用程序移植到 64 位可执行文件,是否必须将其值更改为MACHINEx64".

By default it's value is set to "Not set". Is it compulsory to change it's value to "MACHINEx64" if I want my application to be ported to 64-bit executable.

推荐答案

是的,这是一个非常重要的选项.它设置 IMAGE_FILE_HEADER.Machine 可执行文件中的字段.EXE 或 DLL 头的第一个字段.

Yes, this is a very important option. It sets the IMAGE_FILE_HEADER.Machine field in the executable file. The very first field of the EXE or DLL header.

Windows 在加载 EXE 时会检查这一点,并知道它是否需要从该字段创建 32 位或 64 位进程.它是链接器 + 高级属性页的唯一原因是因为您通常不会更改它.该设置由您创建的项目配置预先选择.如果你得到Not Set",那么你基本上做错了,很难猜到你在做什么.

Windows check this when it loads an EXE and knows whether it needs to create a 32-bit or a 64-bit process from that field. The only reason it is a the Linker + Advanced property page is because you don't normally change it. The setting is pre-selected by the project configuration you created. If you get "Not Set" then you are basically doing it wrong, hard to guess what you are doing.

假设您有一个正确配置的项目,可以为您的程序构建一个有效的 32 位构建,您可以使用构建 + 配置管理器创建 64 位构建.在右上角的活动解决方案平台"组合框中,选择 .在对话框中选择x64".希望其他默认值(从 = Win32 复制设置,勾选创建新项目平台)对您来说是正确的.返回 Linker + Advanced 属性页面,设置应该已更改为 MachineX64.

Assuming you have a properly configured project that builds a working 32-bit build for your program, you create the 64-bit build with Build + Configuration Manager. In the "Active solution platform" combobox at the upper right, select <New...>. Pick "x64" in the dialog. Hopefully the other defaults (Copy settings from = Win32, Create new project platforms ticked) are correct for yours. Go back to the Linker + Advanced property page and the setting should have changed to MachineX64.

这篇关于“目标机器"的目的Visual Studio 中的字段 ->链接器->高级选项->目标机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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