According to this post, the reason of linking error " Undefined reference to 'vtable for XXXX' " is due to some of the virtual function is not written. Especial from the inherent one.
But with Code::Blocks, there is another possibility that could leads the problem. After some research, I discovered a quick to fix the problem, especially the problem is not cause from you but the library.
Code::blocks in Linux may automatically call some program to get config. For example: run following on the terminal:
$wx-config --libs
-L/usr/local/lib -pthread -lwx_gtk2u_xrc-2.9 -lwx_gtk2u_html-2.9 -lwx_gtk2u_qa-2.9 -lwx_gtk2u_adv-2.9 -lwx_gtk2u_core-2.9 -lwx_baseu_xml-2.9 -lwx_baseu_net-2.9 -lwx_baseu-2.9
This is a result from my computer. According to 'wx-config --help', the default output of this parameter is the basic, standard of the linkers. In other word, some special library is not included.
Instead using 'wx-config --libs', you may try following:
$wx-cinfig --libs all
-L/usr/local/lib -pthread -lwx_gtk2u_xrc-2.9 -lwx_gtk2u_stc-2.9 -lwx_gtk2u_richtext-2.9 -lwx_gtk2u_ribbon-2.9 -lwx_gtk2u_propgrid-2.9 -lwx_gtk2u_aui-2.9 -lwx_gtk2u_media-2.9 -lwx_gtk2u_html-2.9 -lwx_gtk2u_qa-2.9 -lwx_gtk2u_adv-2.9 -lwx_gtk2u_core-2.9 -lwx_baseu_xml-2.9 -lwx_baseu_net-2.9 -lwx_baseu-2.9
Soon you may discovered that the number of the linker has increased. This is the main reason that cause you mad.
To modify the setting, goto project properties... → Project build options → Linker Setting → Other linker options.
Change 'wx-config --libs' to 'wx-cinfig --libs all', and re-compile the project.
2010年11月26日 星期五
2010年11月25日 星期四
About wxMediaCtrl in wxWidgets
Recently, I was running on wxMediaCtrl to make a MetroLyricMaker
to use wxMediaCtrl, you must pass --enable-mediactrl to ../configure.
You may also install libgstreamermm-0.10-dev to build the library
to use wxMediaCtrl, you must pass --enable-mediactrl to ../configure.
You may also install libgstreamermm-0.10-dev to build the library
2010年10月29日 星期五
wxWidgets in CodeBlocks
wxWidgets has upgraded to 2.9, and I'm migrated from Dev-Cpp to Code::Blocks
Following is the way to setup the wxWidgets project in Code::Blocks
You should build your library with MSYS
1. Open a project
2. Go through Project / Properties...
3. Go to Project's build options...
4. In Compiler settings / #defines tab, we will add some information here.
4.1 Open MSYS, type wx-config --cppflags, and the terminal will popup like:
-I/usr/local/lib/wx/include/msw-unicode-2.9 -I/usr/local/include/wx-2.9 -D_LARGEFILE_SOURCE=unknown -DWXUSINGDLL -D__WXMSW__
4.2 Copy the this part to #defines
5. Go through Linker settings
5.1For the Link libraries part, you just copy the file's path that end with .dll.a to here by click Edit button. After testing, without this step, it still works.
5.2 For the other linker options, type wx-config --libs in MSYS, and the terminal will popup like:
-L/usr/local/lib -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-2.9 -lwx_mswu_html-2.9 -lwx_mswu_qa-2.9 -lwx_mswu_adv-2.9 -lwx_mswu_core-2.9 -lwx_baseu_xml-2.9 -lwx_baseu_net-2.9 -lwx_baseu-2.9
Copy the this part to Other linker options
6. Goto Search directories
6.1 In compiler tab, add the directory path
mines are:
C:\wx\wxWidgets-2.9.1\mswDebug\lib\wx\include\msw-unicode-2.9
C:\wx\wxWidgets-2.9.1\include
Note that there is always two paths there, former one for the library's setting (unicode? for example). Later one is for other header files.
6.2 In Linker tab, add the directory path
mines is:
C:\wx\wxWidgets-2.9.1\mswDebug\lib
This is where the library place
Following is the way to setup the wxWidgets project in Code::Blocks
You should build your library with MSYS
1. Open a project
2. Go through Project / Properties...
3. Go to Project's build options...
4. In Compiler settings / #defines tab, we will add some information here.
4.1 Open MSYS, type wx-config --cppflags, and the terminal will popup like:
-I/usr/local/lib/wx/include/msw-unicode-2.9 -I/usr/local/include/wx-2.9 -D_LARGEFILE_SOURCE=unknown -DWXUSINGDLL -D__WXMSW__
4.2 Copy the this part to #defines
5. Go through Linker settings
5.1
5.2 For the other linker options, type wx-config --libs in MSYS, and the terminal will popup like:
-L/usr/local/lib -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-2.9 -lwx_mswu_html-2.9 -lwx_mswu_qa-2.9 -lwx_mswu_adv-2.9 -lwx_mswu_core-2.9 -lwx_baseu_xml-2.9 -lwx_baseu_net-2.9 -lwx_baseu-2.9
Copy the this part to Other linker options
6. Goto Search directories
6.1 In compiler tab, add the directory path
mines are:
C:\wx\wxWidgets-2.9.1\mswDebug\lib\wx\include\msw-unicode-2.9
C:\wx\wxWidgets-2.9.1\include
Note that there is always two paths there, former one for the library's setting (unicode? for example). Later one is for other header files.
6.2 In Linker tab, add the directory path
mines is:
C:\wx\wxWidgets-2.9.1\mswDebug\lib
This is where the library place
訂閱:
文章 (Atom)