wxWidgets 在 Linux 下開發環境配置


本文基於 CodeBlocks (16.0.1) 和 wxWidgets (3.0.2) 搭建 Linux 下 GUI 開發環境。

 

1. 安裝 CodeBlocks

  Ubuntu 默認的源當前 CodeBlocks 版本為 13.x,為安裝最新穩定版,如下步驟,

  $ sudo add-apt-repository ppa:damien-moore/codeblocks-stable

  $ sudo apt-get update

  $ sudo apt-get codeblocks

 

2. 下載 wxWidgets Linux 源碼包 wxWidgets-3.0.2.tar.bz2

  - 解壓到任意目錄,比如 ~/wxWidgets-3.0.2   (安裝完成后此包可以刪除)

  - Linux 的安裝說明在 ~/wxWidgets-3.0.2/docs/gtk/install.txt

  - $ ./configure --with-gtk --disable-shared --enable-unicode  # 編譯成 SHARED=0, UNICODE=1, MONOLITHIC=0 (默認)

     輸出信息如下,

   ==================================================================

    Configured wxWidgets 3.0.2 for `x86_64-unknown-linux-gnu'

    Which GUI toolkit should wxWidgets use?                        GTK+ 2 with support for GTK+ printing libnotify
    Should wxWidgets be compiled into single library?            no
    Should wxWidgets be linked as a shared library?              no
    Should wxWidgets support Unicode?                                 yes (using wchar_t)
    What level of wxWidgets compatibility should be enabled?
                                         wxWidgets 2.6      no
                                         wxWidgets 2.8      yes
    Which libraries should wxWidgets use?
                                         STL                    no
                                         jpeg                   sys
                                         png                    sys
                                         regex                builtin
                                         tiff                   sys
                                         zlib                   sys
                                         expat                sys
                                         libmspack          no
                                         sdl                    no

  ==================================================================

  - $ make

  - $ sudo make install

  - $ sudo ldconfig

  - $ wx-config --version   (應該輸出 3.0.2,表示安裝成功)

3. 項目編譯

  - 基於 CodeBlocks: 同 Windows 環境。

  - 基於命令行的編譯 (注意 wx 相關信息如何添加,例如): $ g++ main.cpp simple.cpp `wx-config --cxxflags --libs` -o simple

  

完。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM