【问题标题】:Adding wxWidgets to a project using cmake in Windows在 Windows 中使用 cmake 将 wxWidgets 添加到项目中
【发布时间】:2014-11-13 16:33:22
【问题描述】:

我正在尝试使用 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   

问题是什么,我该如何解决?

【问题讨论】:

    标签: c++ linker cmake wxwidgets


    【解决方案1】:

    wxSplashScreen 是 wxAdvanced library 的一部分,因此您需要告诉 cmake 链接到它以及核心和基础:

    find_package(wxWidgets COMPONENTS core base adv REQUIRED)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-15
      • 2012-11-20
      • 1970-01-01
      相关资源
      最近更新 更多