我正在尝试使用cmake将wxWidgets添加到我的项目中。
在cmake中我有:
#wxWidgets
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base REQUIRED)
include(${wxWidgets_USE_FILE})
对于我在cmake的项目,我有:
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
问题是什么,我该如何解决?
答案 0 :(得分:0)
wxSplashScreen是wxAdvanced library的一部分,所以你需要告诉cmake链接到它以及核心和基础:
find_package(wxWidgets COMPONENTS core base adv REQUIRED)