Building wxWidgets 3.1.0 on CLion (Ubuntu)
Getting started with wxWidgets and CLion?
要学习这些问题,我可以在我的助手中运行Wxwidgets GUI“hello world”程序以使用wxwidgets 3.0.3。
My screenshot
但是我无法以相同的方式运行其他wxwidgets示例(例如网格aui功能区高级GUI),这些GUI示例可以在我的CODE::BLOCKS上运行。
操作系统:Server 2016
孤岛:2017.2.3
wxwidgets:3.0.3
码:: block:16.01
MingW:x86_64-4.9.3-win32-seh-rt_v4-rev1
我的cmakelist.txt文件如下研究了每个地方(wxconfig.exe已复制到cmake bin词典):
修改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})
但我得到一些错误如下
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'
最佳答案
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
另一种方法,如果我们使用“MONOLITHIC = 0”编译Wxwidget,则必须按顺序链接libxxx.a。并添加“-lcomctl32”选项,我的新cmakelist.txt如下所示。
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
)
关于c++ - 在CLion上构建wxWidgets 3.0.3程序(Windows),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46678723/