1.简述
这篇文章主要说明的是将linux上编译的程序放到windows上运行。linux
2.操做方法
2.1 下载必备的交叉编译软件
首先,个人主机与虚拟机都是64位的,虚拟机为ubuntu。ubuntu
$ sudo apt-get install mingw-w64
2.2 编写程序
编写一个简单的测试程序:windows
#include <stdio.h>
int main(int argc,char *argv[])
{
printf("hello world\r\n");
while(1);
return 0;
}
2.3 编译程序
$ x86_64-w64-mingw32-gcc hello.c -o hello.exe
而后将虚拟机作以下设置:测试
配置文件共享.net
使用以下方法将exe拷贝到windows上:blog
$ cp hello.exe /mnt/hgfs/Desktop/
将程序拷贝到windows上。get
2.4 执行程序
按照windows上的程序执行方法,执行该hello.exe便可。
---------------------
做者:weixin_34185320
来源:CSDN
原文:https://blog.csdn.net/weixin_34185320/article/details/87119397
版权声明:本文为博主原创文章,转载请附上博文连接!虚拟机