在CLion(Ubuntu)上构建wxWidgets 3.1.0 [英] Building wxWidgets 3.1.0 on CLion (Ubuntu)

查看:413
本文介绍了在CLion(Ubuntu)上构建wxWidgets 3.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在CLion 1.3项目上构建wxWidgets-3.1.0。我使用Ubuntu 16.04(64位)。基本上,我是这样编辑CMakeLists.txt文件的:

I am currently trying to build wxWidgets-3.1.0 on a CLion 1.3 project. I use Ubuntu 16.04 (64 bit). Basically, I edited the CMakeLists.txt file like this:

cmake_minimum_required(VERSION 3.5)
project(WxProva)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules"
${CMAKE_MODULE_PATH})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(WxProva ${SOURCE_FILES})

find_package(wxWidgets)
include_directories(${wxWidgets_INCLUDE_DIRS})
target_link_libraries(WxProva ${wxWidgets_LIBRARIES})

外部库部分也向我展示了wxWidgets,但是当在main.cpp上写一些行时,与该库相关的所有内容似乎都无法通过编译器访问(它全部用红色编写,就像一个错误)。无论如何,如果我尝试编译,结果就是这样:

The "External Libraries" section also shows me wxWidgets, but when it comes to write some lines on my main.cpp, everything related with the library seems to be unreachable by the compiler (it's all written in red, like an error). Anyway, if I try to compile, that's the result:

/home/federico/ClionProjects/WxProva/main.cpp:2:35: fatal error: wxWidgets-3.1.0/include: File o directory non esistente
compilation terminated.

这就像文件或目录不存在。
我该如何解决?

Which is like "File or directory doesn't exists." How can I fix this?

推荐答案

经过一些实验后,这里的解决方案。您只需复制它并更改一些信息,即可进行构建和运行。

After some experiments here solution. You can just copy it and change some information and ready to build and run.

cmake_minimum_required(VERSION 3.7)
project(Your_Project_Name) //any name for your project

set(CMAKE_CXX_STANDARD 11)

set(wxWidgets_ROOT_DIR </usr/include/wx-3.0-unofficial>) // here I am  giving where to search for wxwidgets library. it can be different for you
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base REQUIRED)
include(${wxWidgets_USE_FILE})

set(SOURCE_FILES main.cpp)
add_executable(FirstC ${SOURCE_FILES})

target_link_libraries(FirstC ${wxWidgets_LIBRARIES})

有关更多信息,请阅读 https://wiki.wxwidgets.org/ CMake

For more Information read https://wiki.wxwidgets.org/CMake

编辑1
在这里,您甚至不必添加一些编译和链接配置( wx-config --cxxflags wx-config --libs ),因为在NetBeans中是必需的

Edit 1 Here you shouldn't even add some compile and link config (wx-config --cxxflags and wx-config --libs) as it is necessary in NetBeans

这篇关于在CLion(Ubuntu)上构建wxWidgets 3.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆