在Ubuntu Linux中从Eclipse交叉编译Windows应用程序?

时间:2023-01-26 22:15:25

I am trying to set up a programming environment to compile Windows executables and libraries from Ubuntu Linux. I have installed MinGW (from the official Ubuntu repositories) and it is working great from the command line; however, I try to use it from within Eclipse, and it neither detects it automatically nor can I seem to find a way to make it work manually.

我正在尝试建立一个编程环境来编译来自Ubuntu Linux的Windows可执行文件和库。我安装了MinGW(来自官方的Ubuntu存储库),它在命令行中运行良好;但是,我尝试在Eclipse中使用它,它既不会自动检测它,也不会找到一种方法让它手动工作。

So, my question is, how can I set up Eclipse to cross-compile Windows applications, preferably using MinGW (although other, alternative solutions are welcome too)?

所以,我的问题是,如何设置Eclipse以交叉编译Windows应用程序,最好使用MinGW(尽管其他替代解决方案也受欢迎)?

2 个解决方案

#1


6  

I used Eclipse Indigo (3.7) with CDT package on MacOSX to cross-compile Windows apps and it works fine. Just for a reference to others interested, I installed mingw with port install i386-mingw32-gcc -universal. In CDT, create new C or C++ project, on the next page of the wizard, select Project Type as "Cross-Compile Project", toolchain - "Cross GCC". On the next page, type Tool Command Prefix (I have i386-mingw32-) and provide a path to mingw tools.

我在MacOSX上使用带有CDT包的Eclipse Indigo(3.7)来交叉编译Windows应用程序,它运行正常。仅仅为了引用其他感兴趣的人,我安装了mingw端口安装i386-mingw32-gcc -universal。在CDT中,创建新的C或C ++项目,在向导的下一页上,选择Project Type作为“Cross-Compile Project”,工具链 - “Cross GCC”。在下一页上,键入工具命令前缀(我有i386-mingw32-)并提供mingw工具的路径。

Complete the wizard, add your files and build!

完成向导,添加文件并构建!

Cheers, Max

#2


-2  

Eclipse requires appropriate executables in your PATH variable. Find where is your MinGW GCC compiler called gcc and then just add its path into your Windows PATH variable. If you want POSIX applications development using Eclipse, please consider Cygwin instead of MinGW.

Eclipse在PATH变量中需要适当的可执行文件。找到你的MinGW GCC编译器名为gcc的位置,然后将其路径添加到Windows PATH变量中。如果您希望使用Eclipse开发POSIX应用程序,请考虑使用Cygwin而不是MinGW。

#1


6  

I used Eclipse Indigo (3.7) with CDT package on MacOSX to cross-compile Windows apps and it works fine. Just for a reference to others interested, I installed mingw with port install i386-mingw32-gcc -universal. In CDT, create new C or C++ project, on the next page of the wizard, select Project Type as "Cross-Compile Project", toolchain - "Cross GCC". On the next page, type Tool Command Prefix (I have i386-mingw32-) and provide a path to mingw tools.

我在MacOSX上使用带有CDT包的Eclipse Indigo(3.7)来交叉编译Windows应用程序,它运行正常。仅仅为了引用其他感兴趣的人,我安装了mingw端口安装i386-mingw32-gcc -universal。在CDT中,创建新的C或C ++项目,在向导的下一页上,选择Project Type作为“Cross-Compile Project”,工具链 - “Cross GCC”。在下一页上,键入工具命令前缀(我有i386-mingw32-)并提供mingw工具的路径。

Complete the wizard, add your files and build!

完成向导,添加文件并构建!

Cheers, Max

#2


-2  

Eclipse requires appropriate executables in your PATH variable. Find where is your MinGW GCC compiler called gcc and then just add its path into your Windows PATH variable. If you want POSIX applications development using Eclipse, please consider Cygwin instead of MinGW.

Eclipse在PATH变量中需要适当的可执行文件。找到你的MinGW GCC编译器名为gcc的位置,然后将其路径添加到Windows PATH变量中。如果您希望使用Eclipse开发POSIX应用程序,请考虑使用Cygwin而不是MinGW。