我按照此页面的说明安装了wxWidgets-2.8.10:
http://wiki.wxwidgets.org/Compiling_and_getting_started
http://wiki.wxwidgets.org/Compiling_and_getting_started
库目录:
alex@alex-linux:/usr/local/lib$ls | grep wx libwx_base-2.8.a libwx_base_net-2.8.a libwx_base_xml-2.8.a libwx_gtk2_adv-2.8.a libwx_gtk2_aui-2.8.a libwx_gtk2_core-2.8.a libwx_gtk2_html-2.8.a libwx_gtk2_qa-2.8.a libwx_gtk2_richtext-2.8.a libwx_gtk2_xrc-2.8.a libwxtiff-2.8.a wx
然后我创建了文件widgetTest.cpp并用以下代码填充它:
http://www.wxwidgets.org/docs/tutorials/hworld.txt
alex@alex-linux:~$cd /home/alex/Tmp alex@alex-linux:~/Tmp$g++ `wx-config --cppflags` `wx-config --libs` widgetTest.cpp /tmp/ccnPCAw5.o: In function `wxCreateApp()': widgetTest.cpp:(.text+0x2d): undefined reference to `wxAppConsole::CheckBuildOptions(char const*,char const*)' /tmp/ccnPCAw5.o: In function `main': ... widgetTest.cpp:(.text._ZN20wxThreadHelperThreadD0Ev[wxThreadHelperThread::~wxThreadHelperThread()]+0x16): undefined reference to `wxThread::~wxThread()' collect2: ld returned 1 exit status
附加信息:
alex@alex-linux:~$wx-config --cppflags -I/usr/local/lib/wx/include/gtk2-ansi-release-static-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ alex@alex-linux:~$wx-config --libs -L/usr/local/lib -pthread /usr/local/lib/libwx_gtk2_richtext-2.8.a /usr/local/lib/libwx_gtk2_aui-2.8.a /usr/local/lib/libwx_gtk2_xrc-2.8.a /usr/local/lib/libwx_gtk2_qa-2.8.a /usr/local/lib/libwx_gtk2_html-2.8.a /usr/local/lib/libwx_gtk2_adv-2.8.a /usr/local/lib/libwx_gtk2_core-2.8.a /usr/local/lib/libwx_base_xml-2.8.a /usr/local/lib/libwx_base_net-2.8.a /usr/local/lib/libwx_base-2.8.a -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lXinerama -lSM -lpng -ljpeg -lexpat -lwxtiff-2.8 -lz -ldl -lm alex@alex-linux:~$
怎么了?
解决方法
这有帮助吗?
g++ `wx-config --cppflags` widgetTest.cpp `wx-config --libs`
有时需要在源之后放置库.