I am trying to cross-compile the following hello-world program
#include <iostream>
int main()
{
std::cout << "Hello world!" << std::endl;
}
My host platform uses Microsoft Visual Studio Express 2012 for Windows Desktop on a Windows 7 SP1 64-bit machine. My target platform is a 32 bit Windows XP Embedded device (Version 2002 Service Pack 2) with 248 MB of RAM. I follow the command line instructions at http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx to do the cross-compilation.
The fact that I can successfully run my hello_world.exe in the 'IE6 on XP' virtual machine from https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/ makes me feel confident that the cross-compiling went fine. However, when I copy the hello_world.exe to my Windows XP Embedded device and try to run it, I get the following Application Error:
Dependency Walker (running on the XP Embedded device) does not show me any DLL problems:
I am stuck here. If anybody can shed a light on why I am getting this strange Application Error and how I can fix it, I would be happy to hear!
Problem solved. The problem was that the CPU of the embedded device did not support certain instructions. I was compiling my hello_world
program without the /arch
option, but for Visual Studio 2012 that means that SSE2 instructions are enabled. Compiling my hello_world
program with the /arch:IA32
option solves the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.