如何处理 Qapplication error, ui_ImageInterface error 等错误, 如何调试cgal 和Qt5程序呢?
2022/7/24 1:25:07
本文主要是介绍如何处理 Qapplication error, ui_ImageInterface error 等错误, 如何调试cgal 和Qt5程序呢?,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
花了很多时间,终于调试好了一个使用qt的cgal程序.
主文件main.cpp代码如下
#include <QApplication> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Triangulation_2.h> #include <CGAL/draw_triangulation_2.h> #include <iostream> #include <vector> typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Triangulation_2<K> Triangulation; typedef Triangulation::Vertex_handle Vertex_handle; typedef Triangulation::Point Point; typedef Triangulation::Finite_vertex_handles Finite_vertex_handles; // The following types are different // Its value type is Triangulation_2::Vertex typedef Triangulation::Finite_vertices_iterator Finite_vertices_iterator; // Its value type is Triangulation_2::Vertex_handle typedef Finite_vertex_handles::iterator Finite_vertex_handles_iterator; int main() { std::vector<Point> points = { Point(0,0), Point(1,0), Point(0,1),Point(1,1),Point(0.5,0.5) }; Triangulation T; T.insert(points.begin(), points.end()); std::cout << "Triangulation_2::Finite_vertices_iterator is like a Triangulation_2::Vertex_handle\n"; for(Finite_vertices_iterator it = T.finite_vertices_begin(); it != T.finite_vertices_end(); ++it){ std::cout << it->point() << std::endl; } std::cout << "Triangulation_2::Finite_vertex_handles::iterator dereferences to Triangulation_2::Vertex_handle\n"; Finite_vertex_handles::iterator b, e; std::tie(b,e) = T.finite_vertex_handles(); for(; b!=e; ++b){ Vertex_handle vh = *b; // you must dereference the iterator to get a handle std::cout << vh->point() << std::endl; } std::cout << "and you can use a C++11 for loop\n"; for(Vertex_handle vh : T.finite_vertex_handles()) { std::cout << vh->point() << std::endl; } CGAL::draw(T); return 0; }
需要的CMakeLists.txt文件如下
# Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. cmake_minimum_required(VERSION 3.1...3.15) project( ex8 ) # CGAL and its components find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND) add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) endif() if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") return() endif() # Boost and its components find_package( Boost REQUIRED ) if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") return() endif() # include for local directory # include for local package # Creating entries for all C++ files with "main" routine # ########################################################## create_single_source_cgal_program( "main.cpp" )
将上述两个文件存入文件夹ex8. 依次执行下面的命令, 编译运行.
1. 运行cmake-gui
2. make中间出错
3. 解决办法是删掉CMakeFiles文件夹里面的内容
4. 然后重新make
5. 最后可以顺利运行,可以得到想要的窗口
这篇关于如何处理 Qapplication error, ui_ImageInterface error 等错误, 如何调试cgal 和Qt5程序呢?的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-23DevExpress 怎么实现右键菜单(Context Menu)显示中文?-icode9专业技术文章分享
- 2024-12-22怎么通过控制台去看我的页面渲染的内容在哪个文件中呢-icode9专业技术文章分享
- 2024-12-22el-tabs 组件只被引用了一次,但有时会渲染两次是什么原因?-icode9专业技术文章分享
- 2024-12-22wordpress有哪些好的安全插件?-icode9专业技术文章分享
- 2024-12-22wordpress如何查看系统有哪些cron任务?-icode9专业技术文章分享
- 2024-12-21Svg Sprite Icon教程:轻松入门与应用指南
- 2024-12-20Excel数据导出实战:新手必学的简单教程
- 2024-12-20RBAC的权限实战:新手入门教程
- 2024-12-20Svg Sprite Icon实战:从入门到上手的全面指南
- 2024-12-20LCD1602显示模块详解