ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

如何处理 Qapplication error, ui_ImageInterface error 等错误, 如何调试cgal 和Qt5程序呢?

2022-07-23 11:04:46  阅读:123  来源: 互联网

标签:Finite typedef Qt5 Point cgal error Triangulation CGAL include


花了很多时间,终于调试好了一个使用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. 最后可以顺利运行,可以得到想要的窗口

 

标签:Finite,typedef,Qt5,Point,cgal,error,Triangulation,CGAL,include
来源: https://www.cnblogs.com/yong-yang/p/16511131.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有