linux下写的程序生成.exe在windows下运行

时间:2020-12-18 17:38:05

第一步:

            安装mingw

            sudo apt-get install mingw32 mingw32-binutils mingw32-runtime

第二部:

            编写纯c程序代码通过GCC/CC编译调试,用mingw输出win目标文件

            i586-mingw32msvc-gcc hello.c -o hello.exe

            linux下写的程序生成.exe在windows下运行

        mingw相关命令 

        C compiler: i586-mingw32msvc-gcc

        C++ compiler: i586-mingw32msvc-g++

        Linker for dynamic libs: i586-mingw32msvc-g++

        Linker for static libs: i586-mingw32msvc-ar

        Debugger: i586-mingw32msvc-gdb