Building wxWidgets 3.0.3 program on CLion (windows)

andrew Source

Building wxWidgets 3.1.0 on CLion (Ubuntu)

Getting started with wxWidgets and CLion?

To learn these question,I can run Wxwidgets GUI "hello world" program in my clion to use wxwidgets 3.0.3.

My screenshot

But I can't run other wxwidgets sample like as grid aui ribbon advance GUI in the same way.These GUI sample can be run at my CODE::BLOCKS.

OS:Server 2016

clion:2017.2.3

wxwidgets:3.0.3

code::block:16.01

MingW: x86_64-4.9.3-win32-seh-rt_v4-rev1

My cmakelist.txt as following after study every where (wxconfig.exe have copy to the cmake bin dictionary) :
Modify the cmakelist,

 cmake_minimum_required(VERSION 3.9)
project(HelloTest)

#set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")

find_package(wxWidgets REQUIRED
        core base aui html jpeg tiff png gif zlib
#        adv dbgrid expat html jpeg ribbon
#        media mono net png propgrid qa
#        regex ribbon  richtext scintilla
#        stc tiff webview  xml xrc zlib
        )

include(${wxWidgets_USE_FILE})

include_directories(D:/IDE/wxWidgets-3.0.3/samples)
set(SOURCE_FILES auidemo.cpp)
add_executable(HelloTest ${SOURCE_FILES})
target_link_libraries(HelloTest ${wxWidgets_LIBRARIES})

But I get some error as following

CMakeFiles\HelloTest.dir/objects.a(auidemo.cpp.obj): In function `MyFrame::CreateGrid()':
D:/IdeaProjects/HelloTest/auidemo.cpp:1568: undefined reference to `wxGrid::CreateGrid(int, int, wxGrid::wxGridSelectionModes)'
CMakeFiles\HelloTest.dir/objects.a(auidemo.cpp.obj): In function `wxGrid::wxGrid(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)':
D:/IDE/wxWidgets-3.0.2/include/wx/generic/grid.h:944: undefined reference to `wxGrid::Init()'
D:/IDE/wxWidgets-3.0.2/include/wx/generic/grid.h:946: undefined reference to `wxGrid::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)'
CMakeFiles\HelloTest.dir/objects.a(auidemo.cpp.obj):auidemo.cpp:(.rdata$.refptr.wxGridNameStr[.refptr.wxGridNameStr]+0x0): undefined reference to `wxGridNameStr'
CMakeFiles\HelloTest.dir/objects.a(auidemo.cpp.obj):auidemo.cpp:(.rdata$.refptr._ZTV6wxGrid[.refptr._ZTV6wxGrid]+0x0): undefined reference to `vtable for wxGrid'
D:/IDE/wxWidgets-3.0.2/lib/gcc_lib/libwxmsw30ud_aui.a(auilib_floatpane.o):floatpane.cpp:(.rdata$.refptr._ZN11wxMiniFrame12ms_classInfoE[.refptr._ZN11wxMiniFrame12ms_classInfoE]+0x0): undefined reference to `wxMiniFrame::ms_classInfo'
D:/IDE/wxWidgets-3.0.2/lib/gcc_lib/libwxmsw30ud_aui.a(auilib_floatpane.o):floatpane.cpp:(.rdata$.refptr._ZTV11wxMiniFrame[.refptr._ZTV11wxMiniFrame]+0x0): undefined reference to `vtable for wxMiniFrame'
D:/IDE/wxWidgets-3.0.2/lib/gcc_lib/libwxmsw30ud_html.a(htmllib_m_image.o): In function `wxHtmlImageCell::wxHtmlImageCell(wxHtmlWindowInterface*, wxFSFile*, int, bool, int, bool, double, int, wxString const&)':
C:\wxWidgets-3.0.2\build\msw/../../src/html/m_image.cpp:393: undefined reference to `wxGIFDecoder::wxGIFDecoder()'
C:\wxWidgets-3.0.2\build\msw/../../src/html/m_image.cpp:394: undefined reference to `wxGIFDecoder::LoadGIF(wxInputStream&)'
D:/IDE/wxWidgets-3.0.2/lib/gcc_lib/libwxmsw30ud_html.a(htmllib_htmlfilt.o):htmlfilt.cpp:(.rdata$.refptr._ZTV20wxStringOutputStream[.refptr._ZTV20wxStringOutputStream]+0x0): undefined reference to `vtable for wxStringOutputStream'
c++cmakewxwidgetsclion

Answers

answered 10 months ago andrew #1

    1.I use "mingw32-make -j 8 -f makefile.gcc BUILD=debug MONOLITHIC=0 SHARED=0 UNICODE=1 USE_GUI=1 USE_OPENGL=1 USE_ODBC=1 RUNTIME_LIBS=static MSLU=1 VENDOR=..  CXXFLAGS=-std=gnu++11 -Wall",The Clion can't compile the sample code.

    2.when I use "mingw32-make -j 8 -f makefile.gcc BUILD=debug ***MONOLITHIC=1*** SHARED=0 UNICODE=1 USE_GUI=1 USE_OPENGL=1 USE_ODBC=1 RUNTIME_LIBS=static MSLU=1 VENDOR=..  CXXFLAGS=-std=gnu++11 -Wall"",all the andvance GUI sample code can be compile and run.

    3.Follow the offical doc,The vision of MingW “x86_64-4.9.3-win32-seh-rt_v4-rev1” be used .it's working well.

    4.I have try the other vison MingW ,it's not working.

screen shot

The other way,if we compile the Wxwidgets use "MONOLITHIC=0",we must link the libxxx.a in order. and add the "-lcomctl32 " option ,My new cmakelist.txt as follow.it's work well;

    cmake_minimum_required(VERSION 3.8)
project(NewTestWxAdv)

set(CMAKE_CXX_STANDARD 11)
include_directories(
        includes
        D:/IDE/wxWidgets-3.0.3/include
#        D:/IDE/wxWidgets-3.0.3/lib/gcc_lib/mswud
        D:/IDE/wxWidgets-3.0.3/lib/gcc_lib/mswu
)
link_directories(
        D:/IDE/wxWidgets-3.0.3/lib/gcc_lib
)

set(
        WX_LIBS
#        libwxmsw30ud_propgrid.a
#        libwxmsw30ud_ribbon.a
#        libwxmsw30ud_stc.a
#        libwxmsw30ud_webview.a
#        libwxmsw30ud_gl.a
#        libwxmsw30ud_richtext.a
#        libwxmsw30ud_xrc.a
#        libwxmsw30ud_aui.a
#        libwxmsw30ud_html.a
#        libwxmsw30ud_adv.a
#        libwxmsw30ud_core.a
#        libwxbase30ud_xml.a
#        libwxbase30ud_net.a
#        libwxbase30ud.a
#        libwxscintillad.a
#        libwxtiffd.a
#        libwxjpegd.a
#        libwxpngd.a
#        libwxzlibd.a
#        libwxregexud.a
#        libwxexpatd.a
#        libwxmsw30ud_media.a

        libwxmsw30u_propgrid.a
        libwxmsw30u_ribbon.a
        libwxmsw30u_stc.a
        libwxmsw30u_webview.a
        libwxmsw30u_gl.a
        libwxmsw30u_richtext.a
        libwxmsw30u_xrc.a
        libwxmsw30u_aui.a
        libwxmsw30u_html.a
        libwxmsw30u_adv.a
        libwxmsw30u_core.a
        libwxbase30u_xml.a
        libwxbase30u_net.a
        libwxbase30u.a
        libwxscintilla.a
        libwxtiff.a
        libwxjpeg.a
        libwxpng.a
        libwxzlib.a
        libwxregexu.a
        libwxexpat.a
        libwxmsw30u_media.a
)

set(SOURCE_FILES aui.cpp)
add_executable(NewTestWxAdv ${SOURCE_FILES})
target_link_libraries(
        NewTestWxAdv
        ${WX_LIBS}
        -lcomctl32
)

comments powered by Disqus