Biên dịch Visual Studio 2012 32bit trên hệ thống 64bit (Visual Studio 2012 32bit compilation on 64bit system)


問題描述

Biên dịch Visual Studio 2012 32bit trên hệ thống 64bit (Visual Studio 2012 32bit compilation on 64bit system)

I have recently wanted to build a dll plugin for a program. Problem is, the program is 32bit, but by default my Visual Studio 2012's C++ compiler creates 64bit binaries, and I don't know how to change it ‑ I've found the Configuration Manager and tried to create a new platform but there's only x64 as an option.

Am I trying to set the target architecture in the wrong place or what? Is there an update or something I can download so that I can create my dll? Is there a compiler switch that I can set somewhere?

Hope this screen helps:


參考解法

方法 1:

To build for 32 bit architecture, you have to open project properties window, and then Linker options. 

Set the value of Target Machine option to MachineX86.

方法 2:

  • Check the Build Configuration (Build ‑> Configuration Manager), and ensure that your DLL project for 32‑bit is selected.
  • Check the linker settings, and ensure correct path is given.
  • After build, check that .DLL is produced at correct path, and is 32‑bit (should be!).

You can use Dependency Walker to check if DLL is 32‑bit or 64‑bit. You also didn't mention if /clr option is used with this DLL or not. With /CLR, managed binary is produced. Though this option wouldn't alter bit‑ness of the binary, you can just check if this is the case.

(by joker.neophyteMani Ghasemnia HamedaniAjay)

參考文件

  1. Visual Studio 2012 32bit compilation on 64bit system (CC BY‑SA 3.0/4.0)

#32-bit #visual-studio-2012 #DLL #C++ #visual-c++






相關問題

內聯彙編 - cdecl 和準備堆棧 (Inline assembly - cdecl and preparing the stack)

來自 32 位用戶代碼的 64 位系統中的 ioctl 命令錯誤 (ioctl command wrong in 64 bit system from 32 bit user code)

Baiklah, PR: Bagaimana mungkin X[i] diinterpretasikan sama dengan i[X] di C? (Alright, homework: How can X[i] possibly be interpretted the same as i[X] in C?)

x32 ABI - гэта інструмент, як ім карыстацца (x32 ABI is this a tool ,how to use this)

Biên dịch Visual Studio 2012 32bit trên hệ thống 64bit (Visual Studio 2012 32bit compilation on 64bit system)

如何讓 Netbeans 7.2 使用 32 位 JVM (How get Netbeans 7.2 to use 32 Bit JVM)

反彙編代碼中的數組聲明 (Declaration of an array in disassembled code)

用C編寫跨平台應用程序 (Writing cross-platform apps in C)

為什麼 BinaryReader.ReadUInt32() 反轉位模式? (Why does BinaryReader.ReadUInt32() reverse the bit pattern?)

32 位 RHEL 機器上的內存使用 (Memory use on 32 bit RHEL machine)

將 32 位應用程序安裝到 C:\Program Files\ 而不是 C:\Program Files(x86)\ 會有什麼負面影響? (What would be the negative effects of installing a 32bit app into the C:\Program Files\ instead of the C:\Program Files(x86)\?)

Arduino 將浮點數轉換為十六進制 IEEE754 單精度 32 位 (Arduino convert float to hex IEEE754 Single precision 32-bit)







留言討論