【问题标题】:wxWidgets how to cross compile an application for windows from linux using codeblocks?wxWidgets 如何使用代码块从 linux 交叉编译 Windows 应用程序?
【发布时间】:2013-10-24 04:03:40
【问题描述】:

我想使用 codeblocks IDE 从 Linux 交叉编译一个用于 Windows 的 wxWidgets 应用程序。

我已通读these 说明,这些说明提供了一些有用的信息,但说明不涉及代码块。

【问题讨论】:

    标签: ubuntu mingw wxwidgets codeblocks wine


    【解决方案1】:

    这些是我在 Ubuntu 13.10 (Saucy Salamander) 上遵循的步骤

    更新系统并安装mingw32和wine:

    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install mingw32 wine
    

    从源代码安装 wxWidgets 2.8:

    sudo su -
    cd /opt
    wget http://downloads.sourceforge.net/project/wxwindows/2.8.12/wxWidgets-2.8.12.tar.gz
    tar -xvzf wxWidgets-2.8.12.tar.gz
    cd wxWidgets-2.8.12/
    ./configure --prefix=/usr/local/i586-mingw32 --host=i586-mingw32msvc --build=i686-linux --disable-shared --enable-unicode
    make
    make install
    

    安装代码块

    sudo apt-get install codeblocks codeblocks-contrib
    

    打开代码块,然后设置如下:

    Settings > Compiler > 
    
       Selected Compiler > GNU GCC Compiler > Copy > New Compiler Name : MinGW Compiler
    
       Selected Compiler > MinGW Compiler
    
       Search Directories > Compiler > Add : /usr/i586-mingw32msvc/include/
       Search Directories > Linker > Add : /usr/i586-mingw32msvc/lib/
       Search Directories > Resource Compiler > Add : /usr/i586-mingw32msvc/include/
    
       Toolchain Executables >
           Program Files >
               Compilers Installation Directory : /usr/i586-mingw32msvc/
               C Compiler : i586-mingw32msvc-gcc
               C++ Compiler : i586-mingw32msvc-g++
               Dynamic Linker : i586-mingw32msvc-g++
               Static Linker : i586-mingw32msvc-ld
          Additional Paths : /usr/bin
    
    Compiler Settings >  Other Options : `/usr/local/i586-mingw32/bin/wx-config --cxxflags` 
    Linker Settings > Other Options : `/usr/local/i586-mingw32/bin/wx-config --libs` 
    

    现在在codeblocks中新建一个项目,关键字段如下:

    New Project > wXWidgets Project
        wXWidgets > 2.8.x
        Preferred GUI Builder > wxSmith
        Compiler > MinGW Compiler
    

    在 Codeblocks 中,点击 compile - 这将设置我们在下一步中需要的应用程序输出文件夹。

    在终端窗口中,将所需的mingwm10.dll 复制到输出文件夹:

    cd <your applications Debug folder>
    cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz .
    gunzip mingwm10.dll.gz
    

    现在用 wine 运行:

    wine ./youappname
    

    要在 Windows 机器上运行您的应用程序,请将 mingwm10.dll 和您的 appname 可执行文件复制到 Windows 机器上。重命名您的应用程序名称以具有后缀 .exe。双击运行。

    【讨论】:

      猜你喜欢
      • 2018-01-14
      • 1970-01-01
      • 2014-07-10
      • 2021-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多