您的位置:首页 > 运维架构 > Linux

wxWidgets 在 Linux 下开发环境配置

2016-08-30 22:27 323 查看
本文基于 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

  

完。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: