C++ 在Windows中使用cmake将wxWidgets添加到项目
我正在尝试使用cmake将wxWidgets添加到我的项目中 在cmake中,我有:C++ 在Windows中使用cmake将wxWidgets添加到项目,c++,linker,cmake,wxwidgets,C++,Linker,Cmake,Wxwidgets,我正在尝试使用cmake将wxWidgets添加到我的项目中 在cmake中,我有: #wxWidgets set(wxWidgets_CONFIGURATION mswu) find_package(wxWidgets COMPONENTS core base REQUIRED) include(${wxWidgets_USE_FILE}) target_link_libraries(MyProject ${OpenCV_LIBS} ${wxWidgets_LIBRARIES
#wxWidgets
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base REQUIRED)
include(${wxWidgets_USE_FILE})
target_link_libraries(MyProject
${OpenCV_LIBS}
${wxWidgets_LIBRARIES}
${Boost_LIBRARIES})
对于我在cmake的项目,我有:
#wxWidgets
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base REQUIRED)
include(${wxWidgets_USE_FILE})
target_link_libraries(MyProject
${OpenCV_LIBS}
${wxWidgets_LIBRARIES}
${Boost_LIBRARIES})
然后使用以下命令运行cmake:
cmake -G "Visual Studio 11 Win64" ..
但是,当我在visual studio中编译生成的项目时,我得到了链接错误:
unresolved external symbol "public: __cdecl wxSplashScreen::wxSplashScreen(class wxBitmap const &,long,int,class wxWindow *,int,class wxPoint const &,class wxSize const &,long)" (??0wxSplashScreen@@QEAA@AEBVwxBitmap@@JHPEAVwxWindow@@HAEBVwxPoint@@AEBVwxSize@@J@Z) referenced in function "public: __cdecl MainWindow::MainWindow(void)" (??0MainWindow@@QEAA@XZ)
unresolved external symbol "public: virtual __cdecl wxSplashScreen::~wxSplashScreen(void)" (??1wxSplashScreen@@UEAA@XZ) referenced in function "public: __cdecl MainWindow::MainWindow(void)" (??0MainWindow@@QEAA@XZ)
unresolved external symbol main referenced in function __tmainCRTStartup
问题是什么?如何解决?wxSplashScreen是的一部分,因此您需要告诉cmake链接到该问题以及core和base:
find_package(wxWidgets COMPONENTS core base adv REQUIRED)