简体   繁体   English

是否可以从 Linux 为 Windows XP 交叉编译 C++ 应用程序?

[英]Is it possible to cross-compile C++ applications from Linux for Windows XP?

I have a simple console application which I already ported to Windows.我有一个简单的控制台应用程序,我已经移植到 Windows。 I also cross-compile it using mingw.我还使用 mingw 交叉编译它。 However the problem is applications compiled like this only run on Windows Vista or newer.然而问题是这样编译的应用程序只能在 Windows Vista 或更新版本上运行。 How would I go about compiling it for XP using Linux?我将如何使用 Linux 为 XP 编译 go? Also, I don't know if this is necessary, but here are my compiler flags:另外,我不知道这是否有必要,但这是我的编译器标志:

x86_64-w64-mingw32-windres src/icon.rc src/icon.o
x86_64-w64-mingw32-g++ -o cli-mg-64bit-windows.exe src/main.cpp src/icon.o -static
i686-w64-mingw32-windres src/icon.rc src/icon.o
i686-w64-mingw32-g++ -o cli-mg-32bit-windows.exe src/main.cpp src/icon.o -static

You to use a version of MinGW-w64 that was built with configure flags --with-default-msvcrt=msvcrt-os and --with-default-win32-winnt=0x0501 .您可以使用使用configure标志--with-default-msvcrt=msvcrt-os--with-default-win32-winnt=0x0501构建的 MinGW-w64 版本。

These flags will result in MinGW-w64 libraries that will only use Windows features available up to Windows XP.这些标志将导致 MinGW-w64 库仅使用 Windows 功能,直到 Windows XP。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM