Linux下使用的GCC编译器图形前端软件wxgcc

wxgcc 的全称是:wxpython gcc compiling toolkit ,它是一个在Linux环境下使用的,基于 wxpython 的GCC 编译器图形前端软件,可以用来快速的编译验证一个 C/C++ 程序,适合 C/C++ 初学者使用!感谢 wzc0066 来稿!

对于Linux用户(尤其是C/C++初学者),不知您是否遇到过这种情况:在进行C/C++编程或是研究他人源代码的时候,发现对于某个C/C++语言特性不是很明确,于是就想自己创建一个小程序编译测试一下。一般需要进行如下操作(以C语言的helloworld为例):

$ vi helloworld.c $ gcc helloworld.c -o helloworld $ ./helloworld

偶尔操作一回当然是没什么问题的,但如果需要频繁这么操作就会让人有些不耐烦了,wxgcc正是为解决这种问题而诞生。

软件下载:

软件依赖:
  • wxpython 2.8
  • gcc编译环境
GCC一般Linux发行版都会默认安装的,对于Ubuntu用户可通过如下命令安装wxpython 2.8:
  • $ sudo aptitude install python-wxgtk2.8 libwxgtk2.8-dev python-wxtools libwxbase2.8-0 libwxgtk2.8-0 python-wxglade
使用方法:下载解压后执行里面的"wxgcc"启动脚本,或者参照README.txt文件!

常用快捷键:

  • F5 - 编译并执行
  • F11 - 全屏显示
  • Ctrl + L - 锁屏进入只读状态
  • Ctrl + F/R - 查找/替换
  • 其它的见程序的菜单栏
使用技巧:
  • 多使用tab键进行代码对齐
  • 语法高亮在按下空格键或是Enter键时变更
更多信息

软件截图:

Read More:

83 Comments

  1. 1 Williamjoy Commented @ 2011-03-23 13:29Reply to this comment

    Geany - A fast and lightweight IDE 也不错

  2. 2 小柳丁 Commented @ 2011-03-23 13:31Reply to this comment

    Geany 推一下

  3. 3 ee.zsy Commented @ 2011-03-23 13:34Reply to this comment

    用Geany嘛,一个文本编辑器,编译按钮就在工具栏上,点一下就行。

    不管是C、C++、Java、OCaml、Haskell还是其他什么的,点一下就可以了哦!

  4. 4 oneday Commented @ 2011-03-23 13:59Reply to this comment

    这个也能要应用程序!

  5. 5 oneday Commented @ 2011-03-23 13:59Reply to this comment

    这个也能叫应用程序!

  6. 6 haha Commented @ 2011-03-23 14:12Reply to this comment

    哈哈,Linux下那个IDE敢和windows下比啊?

  7. 7 Leo Ding Commented @ 2011-03-23 14:12Reply to this comment

    呵呵,也还是不错的,称赞一下 ……

  8. 8 bcbc Commented @ 2011-03-23 14:25Reply to this comment

    够简洁

  9. 9 oldrev Commented @ 2011-03-23 15:46Reply to this comment

    最简单的办法,把一下配置加到 .vimrc 里,以后写 C/C++ 程序直接按 F5 就运行了,其他语言也可如法炮制

    :autocmd BufRead,BufNewFile .c,.cpp,.cxx,.cc map :wa:!gcc -lstdc++ -o %< % :!./%<

  10. 10 soa Commented @ 2011-03-23 15:57Reply to this comment

    @oldrev: 我一般是把:make映射到F5,然后设置

    :set makeprg=gcc\ %
    

    这样make有错误的话会保存在quickfix里面

  11. 11 令狐少侠 Commented @ 2011-03-23 16:00Reply to this comment

    运行之后,风扇噌噌响,何故也?

  12. 12 fanhe Commented @ 2011-03-23 16:03Reply to this comment

    Geany 适合初学者。最近在忙一个把codelite主要组件集成vim的项目。

  13. 13 eagle Commented @ 2011-03-23 16:37Reply to this comment

    @haha: linux要ide吗

  14. 14 bluebear720 Commented @ 2011-03-23 16:46Reply to this comment

    做为推广,IDE似乎不能少,而且也确实有人对IDE情有独钟!

  15. 15 ee.zsy Commented @ 2011-03-23 17:07Reply to this comment

    @haha: Eclipse很强悍的。

  16. 16 liwei Commented @ 2011-03-23 18:37Reply to this comment

    还不如直接Code::Blocks,要么就vim

  17. 17 adonais Commented @ 2011-03-23 18:59Reply to this comment

    这个确实没必要

  18. 18 Daniel King Commented @ 2011-03-23 19:42Reply to this comment

    感觉最强悍的ide就是qtcreator了, 但只能用于qmake的工程. qmake可以用于非qt程序吗? 没研究过.

  19. 19 bachue Commented @ 2011-03-23 19:46Reply to this comment

    话说我平时还特意写个make文件来编译呢

  20. 20 frog Commented @ 2011-03-23 20:17Reply to this comment

    其实不用写makefile, 直接在终端输入make helloworld就可以了。

  21. 21 右京样一 Commented @ 2011-03-23 20:33Reply to this comment

    KDevelop貌似也可以直接跑吧……

  22. 22 kidfruit Commented @ 2011-03-23 21:24Reply to this comment

    @eagle: 对于写逻辑代码和底层代码的人可能不需要,vim足以,但是你要考虑世界上大多数软件都是有界面给不懂编程的用户按按鼠标的,这种程序你不用ide,效率不言而喻。苹果成功就在于把bsd封装的很完美……linux现在还在跟shell折腾。

    PS:想随便写点小测试运行直接用codelite或codeblocks不就行了么? PS2:linux下eclipse总的来说最强大,但是对c++支持一直很差,可惜了。

  23. 23 kidfruit Commented @ 2011-03-23 21:29Reply to this comment

    对了,有没有人用vim的pydiction,这个插件和supertab的Tab补全有冲突,现在我的解决办法是pydiction修改代码使用代替Tab,可是这样就有一个问题,补全变量需要用Tab,补全系统操作比如print之类的需要,比较不爽……有没有办法把两个插件综合一下都用Tab,当supertab的没有可用的时候直接调用pydiction的补全?

  24. 24 Daniel King Commented @ 2011-03-23 22:38Reply to this comment

    @kidfruit: 十分赞同, ide不是为了简单, 而是为了效率.

  25. 25 fanhe Commented @ 2011-03-23 23:23Reply to this comment

    @kidfruit: 改源码。@kidfruit: linux下的ide,我用过的,qtctreator,code::blocks,codeltite,anjuta,eclipse,就kdeveloper要kde没试,vim就不用说了,根本就不是ide。我觉得对c++支持最好的就是codelite了,自动补全功能基本没有缺陷,对类啊,模版的支持都没问题,对类函数之类的局部变量的补全也完全没问题。我一度想写个codelite的vi模拟器的,后来发现,这样折腾不如把它的自动完成组件提取出来,于是正在做……

  26. 26 fanhe Commented @ 2011-03-23 23:28Reply to this comment

    @kidfruit: 没看清楚你的问题,其实那个只是一个字典而已,:h ins-completion你可以查查,你可以把 tab 作成补全,然后加上pydiction字典

  27. 27 fanhe Commented @ 2011-03-23 23:29Reply to this comment

    @fanhe: 把 tab map成ctrl-n补全,参考:h 'complete'

  28. 28 kl Commented @ 2011-03-24 7:26Reply to this comment

    我是来为scite占楼的,很多文本编辑器都可以方便的实现这些功能

  29. 29 Mike Ma Commented @ 2011-03-24 11:57Reply to this comment

    Emacser表示鸭梨很大,这里全部都是Vimer... 表示Emacser只需要 filename

    compile

  30. 30 Mike Ma Commented @ 2011-03-24 11:58Reply to this comment

    @Mike Ma: 表示LinuxToy给我把几个东东搞没了。。。

  31. 31 kidfruit Commented @ 2011-03-24 12:54Reply to this comment

    @fanhe: 具体问题是:pydiction占用了tab,supertab也占用了tab,结果就是按tab只有supertab起作用,pydiction的补全内容没出来。supertab本身做的事情就是把tab绑定到,如果把pydiction的tab映射到实际上还是会和本身的键冲突啊?除非我能把pydiction的内容和omni合并在一起。

  32. 32 kidfruit Commented @ 2011-03-24 12:56Reply to this comment

    ………………linuxtoy吃字符…………难怪fanhe看不懂………………

    我第一个说的是绑定pydiction的tab到“Ctrl+j” 楼上说的是supertab绑定到“Ctrl+x”和“Ctrl+o”

  33. 33 kidfruit Commented @ 2011-03-24 13:03Reply to this comment

    @fanhe: codelite和codeblocks当前阶段没法调试vector、list等STL容器,必须手动设置gdb,而eclipse的cdt可以正常调试。但是eclipse的cdt补全功能太垃圾,比cb或cl差很多……相比而言如果qtcreator能够加入广泛的支持而不是局限于qt,发展潜力更大。

  34. 34 csslayer Commented @ 2011-03-24 13:31Reply to this comment

    @kidfruit: 投奔kdevelop吧,绝对是c系语言神器。

  35. 35 kidfruit Commented @ 2011-03-24 13:33Reply to this comment

    @csslayer: 补全如何?STL容器调试支持如何?

  36. 36 bcbc Commented @ 2011-03-24 15:45Reply to this comment

    kdevelop是c++补全最厉害的,它连变量的作用域也考虑。关键还能把它当编辑器用,不一定要建立项目。

  37. 37 microcai Commented @ 2011-03-24 15:48Reply to this comment

    LS , 你说的是 cdt 吧?

  38. 38 fanhe Commented @ 2011-03-24 15:55Reply to this comment

    @kidfruit: cb的补全也是渣来的,不能跟cl比。eclipse也是用gdb的吧?那应该在cb和cl也能实现啊,不然就麻烦。@kidfruit: 好像确实没办法ictrl-n不能包含omni补全,但可以加入其他标签啊啥的保存,pydiction就是关键词补全而已,可以包含进ictrl-n。自己写函数的话,貌似可以,先ctrl-x,ctrl-o,检测是否pumvisible(),如果否,ctrl-n,自己写写试试。

  39. 39 fanhe Commented @ 2011-03-24 16:12Reply to this comment

    @kidfruit: http://forum.ubuntu.org.cn/viewtopic.php?f=68&t=321063&p=2244936#p2244936,能实现,具体细节肯定你自己diy了

  40. 40 wzc0066 Commented @ 2011-03-24 16:17Reply to this comment
    1. 体验了下Geany,功能确实蛮丰富的,应该可以用来建立开发大型的工程项目之类;不过随手写入了段程序好像需要先保存才能编译执行。。。

    2. 9楼兄弟的方法看起来很酷,将“:autocmd BufRead,BufNewFile .c,.cpp,.cxx,.cc map :wa:!gcc -lstdc++ -o %< % :!./%<”写入到vimrc之后,打开vi写了段程序然后按F5,好像没执行,难道还需要什么插件之类?

    3. wxgcc功能比较单一,且不具备自动补全及多个tab页等开发大型项目所必须的特性,但可以做到即时写入即时执行,方便结果验证,所以只适合用来玩玩小程序了,如用来学习谭浩强的C语言应该还是可以的。。。

  41. 41 csslayer Commented @ 2011-03-24 16:48Reply to this comment

    @kidfruit: 补全绝对让你满意,包括什么宏展开后的补全,模板类补全,都ok。以前别人询问的时候测试过stl和boost,都没问题。

    stl我今天试了试也可以调试。

    另外当前没有include的如果输入完整名称还能加入缺少头文件什么的。

    (因为我都写c语言代码,不怎么写c++最近,所以支不支持都得现测……)

  42. 42 wzc0066 Commented @ 2011-03-24 18:00Reply to this comment

    wxgcc这个软件或许很平凡,但却引出了众多名家推荐的众多名器:Geany,qtcreator,KDevelop,codelite,codeblocks,scite ... 很多之前都是闻所未闻,看来也算是抛砖引玉了!

  43. 43 ee.zsy Commented @ 2011-03-24 18:59Reply to this comment

    @wzc0066: 那来顺便推荐两个可以把C/C++当嵌入脚本的东西吧。

    先说tcc,可以用tcc -run file.c直接运行c程序。不用编译可以立刻看到执行效果,想生成可执行文件可行。

    还有一个叫cint,在debian的ROOT包里面,不过最好自己make源码。它可以用交互模式写C/C++语句,用REPL偶尔要测试一点语句的时候还是很方便的。

  44. 44 ee.zsy Commented @ 2011-03-24 19:03Reply to this comment

    @wzc0066: Emacs和Eclipse呢,比启动时间哪个程序能超过它们的。

  45. 45 uu Commented @ 2011-03-24 19:15Reply to this comment

    kdevlop的补全的话,可能要调整一下默认配置,将补全级别设置为完全,另外,默认的补全快捷键竟然是Ctrl+Space,完全不考虑输入法用户,也要修改一下。对于系统文档,查找超爽,不知道函数参数意思,将指针移到函数上,就能看到简要文档,点击打开文档,直接在面板上打开帮助文档。支持man,超赞。

  46. 46 gml520 Commented @ 2011-03-24 19:31Reply to this comment

    为什么就没有人用NetBeans的C/C++插件呢? NetBeans 写C/C++ 也是非常强悍的。

  47. 47 wzc0066 Commented @ 2011-03-24 19:53Reply to this comment

    @ee.zsy: 涨见识了。。。 把一个C/C++文件当着参数直接运行,用Shell脚本也很容易实现的,不过还是先得创建文件!当然了,tcc肯定还有很多其它功能了。。。

  48. 48 ee.zsy Commented @ 2011-03-24 20:42Reply to this comment

    @wzc0066: 那那我那啥的我说,当嵌入脚本用的意思是可以把代码当字符串传过去,不要创建文件的。这样可以用C语言来写Shell脚本。并且在cint中可以输入一句运行一句,就像Python的交互模式一样,可以交互试验语句的效果。用C/C++做脚本语言的最大好处就是要性能的时候可以让gcc编译去。

  49. 49 kidfruit Commented @ 2011-03-24 21:47Reply to this comment

    @bcbc: 变量作用域貌似很多ide都考虑了…… @fanhe: linux下c++的ide全都用的gdb调试,但是调试参数都不一样,eclipse有一套自己的转换工具,可以将STL容器的值列出来,而cb和cl的调试器调用gdb的时候没有处理过,所以显示出来的只有容器的指针,需要手动配置才能显示值,很麻烦。另外你说的vim的方法就是说如果omni之后没有合适的就调用pydiction的字典?那不是一下就能写好的吧……

  50. 50 kidfruit Commented @ 2011-03-24 21:49Reply to this comment

    @csslayer: kdevelop依赖kde-workspace这个庞然大物啊……我试试看。

  51. 51 kidfruit Commented @ 2011-03-24 21:51Reply to this comment

    @gml520: netbeans和eclipse的c++插件比较类似………

  52. 52 csslayer Commented @ 2011-03-25 4:04Reply to this comment

    @kidfruit: ……eclipse还要jre呢。。。而且eclipse那性能,我以前用cdt的时候算是受够了……

  53. 53 oldrev Commented @ 2011-03-25 8:11Reply to this comment

    @wzc0066

    里面的尖括号被吃掉了,去这里看: http://pastebin.com/eM9TbVAt

  54. 54 wzc0066 Commented @ 2011-03-25 9:09Reply to this comment

    @oldrev: 多谢! 在Linux下测试需要改成如下才行:'!% '!./%<',即除掉后缀'.exe',然后加上当前路径'./'

  55. 55 wzc0066 Commented @ 2011-03-25 9:11Reply to this comment

    @oldrev: oh, 字符也被吃掉了,对应的改成这样:'!./%<',然后就变成一利器了!

  56. 56 simon Commented @ 2011-03-25 11:41Reply to this comment

    没人用codeblock么?

  57. 57 uu Commented @ 2011-03-25 18:47Reply to this comment

    @simon: codeblock名不副实,就是一坨屎。

  58. 58 fanhe Commented @ 2011-03-26 22:05Reply to this comment

    @simon: 传说codelite的作者一开始是为codeblocks写插件的,后来决定自己开个项目。codeblocks的自动补全,多少年过去了,还是一个渣字来形容,我终于理解codelite作者单干一个codelite的原因了。

  59. 59 Daniel King Commented @ 2011-03-26 22:38Reply to this comment

    很长一段时间天天下codeblocks的nightly版,发现没啥变化⋯⋯

    话说还有很长一段时间隔三差五的下netbeans的ruby版,这么多年了除了中间支持了个rails3,也没发现啥变化⋯⋯

  60. 60 simon Commented @ 2011-03-27 9:08Reply to this comment

    @uu: 我觉得挺好用的啊,实验室的项目我全用这个写。codelite我也用过,觉得比cb渣,不过那是2年前了。

  61. 61 simon Commented @ 2011-03-27 9:09Reply to this comment

    @fanhe: 这个我知道,只是一直用cb用惯了,没有评测各ide的精力了。。。

  62. 62 simon Commented @ 2011-03-27 9:14Reply to this comment

    话说,C++0x最终批准了,没人关注么?

  63. 63 adam8157 Commented @ 2011-03-27 9:36Reply to this comment

    " Save & Make nnoremap :w:make! nnoremap :w:make! %< CC=gcc CFLAGS="-Wall -g -O2":!./%<

  64. 64 adam8157 Commented @ 2011-03-27 9:37Reply to this comment
    " Save & Make 
    nnoremap  :w:make!
    nnoremap  :w:make! %< CC=gcc CFLAGS="-Wall -g -O2":!./%<
  65. 65 adam8157 Commented @ 2011-03-27 9:38Reply to this comment

    晕, 不晓得怎么插入代码能正常显示...还是直接去看我的vimrc吧....

  66. 66 xiaq Commented @ 2011-03-27 16:26Reply to this comment

    @simon:

    这个和本站主题无关吧,我说。。

  67. 67 none Commented @ 2011-03-27 21:50Reply to this comment

    Eclipse, 启动真头大,等启动起来想作什么都不知道了。

  68. 68 zhichyu Commented @ 2011-03-28 8:28Reply to this comment

    @simon: 哪里来的消息,http://en.wikipedia.org/上c++0x页还没有提到呢

  69. 69 bcbc Commented @ 2011-03-28 9:34Reply to this comment

    @zhichyu: wiki有这么一段:As of March 2011, the JTC1/SC22/WG21 C++ Standards Committee has voted the C++0x specification to FDIS status.[3] This means that it is ready for review and approval by the ISO; the final specification is expected to be published sometime in the summer of 2011.

  70. 70 simon Commented @ 2011-03-28 10:06Reply to this comment

    @zhichyu: slashdot上的消息。

  71. 71 simon Commented @ 2011-03-28 10:07Reply to this comment

    @zhichyu: http://developers.slashdot.org/story/11/03/26/1949225/ISO-C-Committee-Approves-C0x-Final-Draft

  72. 72 xiaq Commented @ 2011-03-30 20:33Reply to this comment

    @simon:

    final draft 相当于 feature release

  73. 73 winger Commented @ 2011-04-01 8:43Reply to this comment

    @kidfruit

    最好的方式 就是把插件给k了(或者自己修改) 我全用最原始的字典 和 映射 利用vim 本身的功能扩展

    既然要花如此多的时间 不妨geek下 深入再深入(code is zen)

  74. 74 wzc0066 Commented @ 2011-04-06 14:24Reply to this comment

    wxgcc从V1.8.5开始支持windows平台运行。

  75. 75 skandhas Commented @ 2011-04-07 11:41Reply to this comment

    个人感觉,用处不大。玩玩还行。

  76. 76 zechen11 Commented @ 2011-04-12 21:29Reply to this comment

    层出不穷啊

  77. 77 wzc0066 Commented @ 2011-04-13 8:11Reply to this comment

    wxgcc v1.8.6添加了交互终端窗口,从而可以支持运行scanf(), getchar()之类需要与用户交互的函数。

  78. 78 ollydbg from codeblocks forum Commented @ 2011-04-26 19:49Reply to this comment

    codelite的代码补全方法也不完善,我差不多看过,采用了ctags和bison的混合方法。。。

    codeblocks的方法,基本就是一个自己写的parser,但是由于没有进行preprocessor和semantic分析,代码提示有问题是必然的。

    注:codelite的ctags也没有preprocessor和sematic分析。

    目前如果需要准确的sematic代码分析结果,只能依赖clang编译器或者gcc编译器了,我之前发布了一个基于gcc sense的补丁在codeblocks论坛,大家可以看看。clang很不错,本身就提供了代码补全的功能。

  79. 79 ollydbg from codeblocks forum Commented @ 2011-04-26 19:51Reply to this comment

    相关的讨论在这里: http://forum.ubuntu.org.cn/viewtopic.php?f=70&t=282866

    还有,gdb加上python的pretty脚本,显示stl的非常轻松,见: http://code.google.com/p/qp-gcc/wiki/GDB

  80. 80 fanhe Commented @ 2011-04-26 20:41Reply to this comment

    @ollydbg from codeblocks forum: clang的效果还行,暂时发现不能在头文件中补全,而且比较大的问题是比较慢,如果加了预编译头,快是快一点,但是如果预编译头包含了很多头文件的话,在自动补全时,提示就超过了源文件本身可见的符号,可能有接口可一详细控制也说不定。我只知道,等cb完善它的自动完成,估计clang都能完全替代gcc了。我决定用vim搭建一个IDE,暂时算是完成了项目管理和基于clang的自动完成,后续是添加codelite的基于ctags的自动完成,最后再搞调试器集成。http://forum.ubuntu.org.cn/viewtopic.php?f=68&t=326808,

  81. 81 fanhe Commented @ 2011-04-26 20:51Reply to this comment

    @ollydbg from codeblocks forum: 再说下之前我跟你说过的编辑器闪烁问题,我想codelite作者反应过问题了,他也知道了,是Linux平台wxwidgets的问题。嘛,反正我对其他编辑器没什么想法了,vim够用了,需要啥功能,自己写,顶多用点python。

  82. 82 ollydbg from codeblocks forum Commented @ 2011-04-27 8:14Reply to this comment

    佩服佩服,你居然自己搞了一个IDE,厉害啊! 关于clang的代码完成,理论上其实就是和一般的编译器一样,走一边当前的translation unit,只不过到当前的光标位置就停止了,然后根据当前光标前的scope,罗列出所有可能的symbol。

    vim有一个clang的自动补全插件,但是我影响中,好像是调用了clang.exe的方式来实现的,我个人感觉速度肯定不太理想。codelite的作者eranif在codelite的源代码里面有一块内容,也是调用clang.exe来实现的代码补全。我感觉这样通过线程调用的方式,肯定不如直接链接clang的库,呵呵,我在codeblocks论坛里面发过一个帖子和demo,演示了直接链接到clang的库的一个程序小例子。

    对于c++语言来说,巨大的头文件在所难免,所以速度我个人觉得很难有大的提升,PCH我觉得应该可以带来比较大的提升,但是PCH文件本身也很大,我以前测试过gccsense的时候,PCH一般来说都能达到50M+。呵呵。codelite的作者说他未来的计划是加入clang支持的代码补全,不过不是替换ctags的parser,他说只是在ctags+bison parser不行的情况下,再由clang出马来办事。

    头文件中的补全,是因为我们不知道当前的头文件是属于哪个translation unit的,因为不同的translation Unit,可能连宏定义这种东西都可能不一样,所以如果想进行代码补全,必须要指定是基于某个translation unit的。这个好像clang的命令行参数里面有支持吧,也许vim的插件还没有做好而已。

    我以前也在codeblocks论坛里面鼓吹说加入clang的代码补全,只不过响应的人太少,我自己也觉得能力太有限,就暂时放弃了。我当时比较了gcc和clang的协议,个人感觉还是gpl的看起来爽一点,clang毕竟是苹果公司的投资项目,有一些长远的顾虑。

    PS:好像我无法收到这里发帖的notification email,你们能收到么?奇怪。

  83. 83 fanhe Commented @ 2011-04-27 8:40Reply to this comment

    这里不提供回复提醒的。讨论我转到论坛了