问个问题,在codeblocks中使用wxWidgets,应该如何设置????

C、C++和Java语言
回复
akinggw
帖子: 2
注册时间: 2008-09-28 11:09
送出感谢: 0
接收感谢: 0

问个问题,在codeblocks中使用wxWidgets,应该如何设置????

#1

帖子 akinggw » 2008-09-28 11:16

我在codeblocks中使用wxWidgets,我直接使用它得项目建立生成了一个东东,但在编译时出现下面得错误:

Compiling: wxdemoApp.cpp
In file included from /home/akinggw/我得程序/wxdemo/wxdemoApp.cpp:19:
/home/akinggw/我得程序/wxdemo/wxdemoMain.h:20: error: invalid use of incomplete type ‘struct wxFrame’
/usr/include/wx-2.8/wx/utils.h:50: error: forward declaration of ‘struct wxFrame’
/home/akinggw/我得程序/wxdemo/wxdemoMain.h:30: error: ‘wxCloseEvent’ has not been declared
/home/akinggw/我得程序/wxdemo/wxdemoMain.h:31: error: ‘wxCommandEvent’ has not been declared
/home/akinggw/我得程序/wxdemo/wxdemoMain.h:32: error: ‘wxCommandEvent’ has not been declared
/home/akinggw/我得程序/wxdemo/wxdemoApp.cpp: In function ‘wxAppConsole* wxCreateApp()’:
/home/akinggw/我得程序/wxdemo/wxdemoApp.cpp:21: error: cannot allocate an object of abstract type ‘wxdemoApp’
/home/akinggw/我得程序/wxdemo/wxdemoApp.h:16: note: because the following virtual functions are pure within ‘wxdemoApp’:
/usr/include/wx-2.8/wx/app.h:89: note: virtual int wxAppConsole::OnRun()
/home/akinggw/我得程序/wxdemo/wxdemoApp.cpp: In member function ‘virtual bool wxdemoApp::OnInit()’:
/home/akinggw/我得程序/wxdemo/wxdemoApp.cpp:27: error: ‘class wxdemoFrame’ has no member named ‘Show’
Process terminated with status 1 (0 minutes, 1 seconds)
7 errors, 0 warnings

后来上网查资料,说要设置什么东西,具体如下:

Maybe your setup is faulty?

We have same os. I got wx from "http://apt.wxwidgets.org/hardy-wx main" and cb from "http://lgp203.free.fr/ubuntu/hardy universe".

Using "File-New project-wxWidgets project" wizard generates a working project file for me. Magic settings are:
compiler: `wx-config --cflags`
linker: `wx-config --libs`

You may check these setting from shell (removing `'s). 

到这里,我就没看懂了,在哪里设置呀:

Using "File-New project-wxWidgets project" wizard generates a working project file for me. Magic settings are:
compiler: `wx-config --cflags`
linker: `wx-config --libs`

后来发现应该在项目选项中得"Custom variables"中,设置,但怎么设置都不正确,请高手出来讲解一下,谢谢!
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
送出感谢: 0
接收感谢: 0
联系:

Re: 问个问题,在codeblocks中使用wxWidgets,应该如何设置????

#2

帖子 kofshower » 2008-10-04 4:31

看codeblock的wiki,验证你的wx-config --cflags
再说wx-config 也是有多个候选的。比如你机子先安了一个debug shared,再安装一个release shared,最后直接写wx-config --libs链接的是release shared。所以即使你编译通过链接可能出错的
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
devin
帖子: 189
注册时间: 2008-08-26 22:57
来自: 长沙
送出感谢: 0
接收感谢: 0

Re: 问个问题,在codeblocks中使用wxWidgets,应该如何设置????

#3

帖子 devin » 2008-10-04 10:01

compiler: `wx-config --cflags`
linker: `wx-config --libs`

这个设置是指在编译选项里加 `wx-config --cflags` ,在连接选项里加 `wx-config --libs`

对应到gcc编译器,就是g++后加 `wx-config --cflags`,ld后加 `wx-config --libs`

你是不是没有注意到这两个选项都是用 ` 号的括起来的,而且这个 ` 号不是 ' 号,也就是说这个 ` 号是键盘左上角的~号下面的那个符号。

ps: "我得程序"??? :em04
回复

回到 “C/C++/Java”