简体   繁体   English

用于Windows桌面的MS Visual Studio 2012 Express - 针对Windows XP

[英]MS Visual Studio 2012 Express for Windows Desktop - Targeting Windows XP

I have recently upgraded from Visual Studio Express 2010 to Visual Studio 2012 Express for Windows Desktop. 我最近从Visual Studio Express 2010升级到Visual Studio 2012 Express for Windows Desktop。 I'm aware of the previous lack of compatibility targeting Windows XP, but thought this was resolved by Update 1 (which I have installed). 我知道之前缺乏针对Windows XP的兼容性,但认为这是由Update 1(我已安装)解决的。

However, I'm still having difficulty targeting Win XP with the C++ applications I have compiled using 2012 Express. 但是,我仍然难以使用我使用2012 Express编译的C ++应用程序来定位Win XP。 I have set the Platform Toolset to "Visual Studio 2012 - Windows XP (v110_xp)" but this makes no difference. 我已将平台工具集设置为“Visual Studio 2012 - Windows XP(v110_xp)”,但这没有任何区别。 When I try to run my compiled application on my Windows XP system (I run Windows XP via VirtualBox), I get an the error that my application "is not a valid Win32 application." 当我尝试在我的Windows XP系统上运行已编译的应用程序时(我通过VirtualBox运行Windows XP),我得到一个错误,即我的应用程序“不是有效的Win32应用程序”。

I have also tried setting the CLR Support to "No Common Language Runtime Support" and the Runtime Library to "Multi-threaded (/MT)". 我还尝试将CLR支持设置为“无公共语言运行时支持”,将运行时库设置为“多线程(/ MT)”。

Even with a very basic blank C++ project using the following code, I just can't get it to run on XP: 即使使用以下代码进行非常基本的空白C ++项目,我也无法让它在XP上运行:

#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
#define NTDDI_VERSION 0x0501

#include <iostream>

int main()
{
    std::cout << "TEST" << std::endl;

    std::cout << std::endl << std::endl << "Press ENTER to close this window.";
    std::cin.get();
    return 0;
}

Can anybody tell me where I'm going wrong with my compiler/project settings? 任何人都可以告诉我我的编译器/项目设置出错了吗?

Ps I have installed the MS VC++ 2010 and 2012 redistributable packages on my XP virtual machine. 我在我的XP虚拟机上安装了MS VC ++ 2010和2012可再发行组件包。 Applications that I compiled with Visual Studio Express 2010 work fine on my XP virtual machine. 我使用Visual Studio Express 2010编译的应用程序在我的XP虚拟机上运行良好。

Check your project's " Configuration Properties -> Linker -> System -> Subsystem " properties. 检查项目的“ 配置属性 - > 链接器 - > 系统 - > 子系统 ”属性。
If blank, fill it with (/SUBSYSTEM:CONSOLE) or (/SUBSYSTEM:WINDOWS) . 如果为空,请填写(/SUBSYSTEM:CONSOLE)(/SUBSYSTEM:WINDOWS)

This works: 这有效:

Configuration Properties -> Linker -> System -> Subsystem = /SUBSYSTEM:WINDOWS 配置属性 - >链接器 - >系统 - >子系统= / SUBSYSTEM:WINDOWS

Configuration Properties -> General -> Platform Tool Set -> SubsystemVisual Studio 2012 - Windows XP (v110_xp) 配置属性 - >常规 - >平台工具集 - > SubsystemVisual Studio 2012 - Windows XP(v110_xp)

Using Visual Studio 2012 Express Update 3. 使用Visual Studio 2012 Express Update 3。

Use GNU GCC tool chain, bro, that redistrebuted with mingw. 使用GNU GCC工具链,兄弟,用mingw重新编写。 MSVS actualy just minimize dependencies, but some of them still stay in exe. MSVS实际上只是最小化依赖性,但其中一些仍然保留在exe中。 Just compiling in gcc suports full static linking, with small exe size and stable compatibility. 只需在gcc中编译支持完全静态链接,具有较小的exe大小和稳定的兼容性。

The message is indicating that your build isn't producing a 32 bit application--if it were a version dependent API, for example, you'd see another error indicating that the symbol can't be found. 该消息表明您的构建不生成32位应用程序 - 例如,如果它是依赖于版本的API,您会看到另一个错误,指示无法找到该符号。 Since you have indicated that you are using the correct target platform in the configuration manager, check your property explorer to make sure you don't have conflicting arguments or defaults. 由于您已指示在配置管理器中使用正确的目标平台,请检查属性资源管理器以确保没有冲突的参数或默认值。 If you see link with the option /MACHINE:X64, then you've found the problem. 如果您看到选项/ MACHINE:X64的链接,那么您已经发现了问题。

If that doesn't work, I suppose you could try running Sysinternals process explorer to see which cl/link are actually being launched with which arguments. 如果这不起作用,我想您可以尝试运行Sysinternals进程资源管理器,以查看哪些cl / link实际上正在使用哪些参数启动。 Hope that helps. 希望有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2012项目使用MFC定位Windows XP - Visual Studio 2012 Project targeting Windows XP using MFC 如何使用CMake生成针对Windows XP的Visual Studio 2012项目? - How can I generate a Visual Studio 2012 project targeting Windows XP with CMake? 使用不带Visual Studio的构建工具2015定位Windows XP - Targeting Windows XP using Build Tools 2015 without Visual Studio 针对Windows 2000的Visual Studio 2012 Win32项目 - visual studio 2012 win32 project targeting windows 2000 尝试在Visual Studio Express 2012 for Windows Desktop中安装SDL_ttf - Trying to install SDL_ttf in Visual Studio Express 2012 for Windows Desktop 如何使用 Visual Studio 2012 为 Windows XP 进行编译? - How do I compile for Windows XP with Visual Studio 2012? 在Visual Studio 2015中使用XP Targeting进行编译时,Windows XP上出现致命错误 - Fatal error on Windows XP when compiled with XP Targeting in Visual Studio 2015 为什么在Visual Studio中缺少Visual Studio 2012的选项 - Windows XP(v110_xp)? - Why is the option for Visual Studio 2012 - Windows XP (v110_xp) missing in Visual Studios? 如何使用Visual Studio 2017构建针对Windows XP的Winsock2(WS2_32.lib)应用程序 - How to build a Winsock2 (WS2_32.lib) application targeting Windows XP with Visual Studio 2017 使用 Visual Studio 2013/2015 以后的 MFC 应用程序以 Windows XP 为目标 - Targeting Windows XP in MFC application using Visual Studio 2013/2015 onward
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM