从VS2012在Windows 7到Windows XP上交叉编译hello world程序

时间:2015-12-21 12:31:20

标签: visual-studio-2012 cross-platform windows-xp windows-xp-embedded dependency-walker

我正在尝试交叉编译以下的hello-world程序

#include <iostream>

int main()
{
    std::cout << "Hello world!" << std::endl;
}

我的主机平台在Windows 7 SP1 64位计算机上使用Microsoft Visual Studio Express 2012 for Windows Desktop。我的目标平台是32位Windows XP Embedded设备(版本2002 Service Pack 2),具有248 MB RAM。我按照http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx处的命令行说明进行交叉编译。

我可以在XP&#39;&#39; IE6中成功运行我的hello_world.exe。来自https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/的虚拟机让我对交叉编译很好有信心。但是,当我将hello_world.exe复制到我的Windows XP Embedded设备并尝试运行它时,我收到以下应用程序错误:

enter image description here

Dependency Walker(在XP Embedded设备上运行)没有向我显示任何DLL问题:

enter image description here enter image description here

我被困在这里。如果有人能说明我为什么会遇到这个奇怪的应用程序错误以及如何解决它,我会很高兴听到!

1 个答案:

答案 0 :(得分:0)

问题解决了。问题是嵌入式设备的CPU不支持某些指令。我正在编译没有hello_world选项的/arch程序,但对于Visual Studio 2012,这意味着启用了SSE2指令。使用hello_world选项编译我的/arch:IA32程序可以解决问题。

相关问题