2016-09-21 373 views
0

我正在嘗試在Linux操作系統上編譯Windows應用程序。我需要mingw來做到這一點。我讀到Debian已經安裝了mingw軟件包。當我運行shell命令:在Linux上安裝mingw

apt-cache search mingw 

我得到的輸出:

binutils-mingw-w64 - Cross-binutils for Win32 and Win64 using MinGW-w64 
binutils-mingw-w64-i686 - Cross-binutils for Win32 (x86) using MinGW-w64 
binutils-mingw-w64-x86-64 - Cross-binutils for Win64 (x64) using MinGW-w64 
g++-mingw-w64 - GNU C++ compiler for MinGW-w64 
g++-mingw-w64-i686 - GNU C++ compiler for MinGW-w64 targeting Win32 
g++-mingw-w64-x86-64 - GNU C++ compiler for MinGW-w64 targeting Win64 
gcc-mingw-w64 - GNU C compiler for MinGW-w64 
gcc-mingw-w64-base - GNU Compiler Collection for MinGW-w64 (base package) 
gcc-mingw-w64-i686 - GNU C compiler for MinGW-w64 targeting Win32 
gcc-mingw-w64-x86-64 - GNU C compiler for MinGW-w64 targeting Win64 
gcc-mingw32 - GNU Compiler Collection for MinGW32 (transition package) 
gfortran-mingw-w64 - GNU Fortran compiler for MinGW-w64 
gfortran-mingw-w64-i686 - GNU Fortran compiler for MinGW-w64 targeting Win32 
gfortran-mingw-w64-x86-64 - GNU Fortran compiler for MinGW-w64 targeting Win64 
gnat-mingw-w64 - GNU Ada compiler for MinGW-w64 
gnat-mingw-w64-i686 - GNU Ada compiler for MinGW-w64 targeting Win32 
gnat-mingw-w64-x86-64 - GNU Ada compiler for MinGW-w64 targeting Win64 
gobjc++-mingw-w64 - GNU Objective-C++ compiler for MinGW-w64 
gobjc++-mingw-w64-i686 - GNU Objective-C++ compiler for MinGW-w64 targeting Win32 
gobjc++-mingw-w64-x86-64 - GNU Objective-C++ compiler for MinGW-w64 targeting Win64 
gobjc-mingw-w64 - GNU Objective-C compiler for MinGW-w64 
gobjc-mingw-w64-i686 - GNU Objective-C compiler for MinGW-w64 targeting Win32 
gobjc-mingw-w64-x86-64 - GNU Objective-C compiler for MinGW-w64 targeting Win64 
gdb-mingw-w64 - Cross-debugger for Win32 and Win64 using MinGW-w64 
gdb-mingw-w64-target - Cross-debugger server for Win32 and Win64 using MinGW-w64 
libconfig++-dbg - parsing and manipulation of structured config files(C++ debug symbols) 
libconfig++-dev - parsing and manipulation of structured config files(C++ development) 
libconfig++9 - parsing and manipulation of structured configuration files(C++ binding) 
libconfig-dbg - parsing and manipulation of structured config files(debug symbols) 
libconfig-dev - parsing and manipulation of structured config files(development) 
libconfig-doc - parsing and manipulation of structured config files(Documentation) 
libconfig9 - parsing and manipulation of structured configuration files 
mingw-ocaml - OCaml cross-compiler based on mingw 
mingw32-ocaml - OCaml cross-compiler based on mingw -- dummy transitional package 
mingw-w64 - Development environment targetting 32- and 64-bit Windows 
mingw-w64-dev - Development files for MinGW-w64 (transitional package) 
mingw-w64-i686-dev - Development files for MinGW-w64 targeting Win32 
mingw-w64-tools - Development tools for 32- and 64-bit Windows 
mingw-w64-x86-64-dev - Development files for MinGW-w64 targeting Win64 
mingw32 - Minimalist GNU win32 (cross) compiler 
mingw32-binutils - Minimalist GNU win32 (cross) binutils 
mingw32-runtime - Minimalist GNU win32 (cross) runtime 

當我檢查在/ usr/bin中/和/ usr /針對i686-W64-mingw32的LIB我不能隨時隨地找到它。

我也發現搜索唱找到名字「明暗」沒有多少運氣。

Debian是否帶有mingw或我必須安裝它?如果它與明確來了我怎麼使用它?

+0

如果我沒有弄錯,'apt-cache search'搜索可用的包。如果你還沒有安裝它們,或者它們尚未安裝,那麼在你這樣做之前你不會找到它們。 –

+0

你試過'find/usr -name'* mingw *''?祝你好運。 – shellter

回答

0

安裝與wine64工具鏈(用於運行Windows可執行文件):

sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine64

編譯:

gcc-mingw-w64-x86-64 -o hello.exe hello.c

檢查結果:

file hello.exe

運行:

wine64 ./hello.exe

還有gdb-mingw-w64提供/usr/bin/x86_64-w64-mingw32-gdb,但我無法弄清楚它是如何工作(當我嘗試它說Don't know how to run. Try "help target".)。