5

I've c++ qt project using opengl and CGAL but I've the following error:

/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>

I searched about the problem and most of solutions about -DENABLE_PRECOMPILED_HEADERS=OFF I use it at .pro file and it doesn't solve the problem .

.pro file :

QT       += core gui opengl
QT += xml
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = try_gui
TEMPLATE = app


    DEFINES += QT_DEPRECATED_WARNINGS

    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


     DENABLE_PRECOMPILED_HEADERS=OFF
    SOURCES += \
            main.cpp \
            mainwindow.cpp \
        my_polyhedron.cpp \
        myqglwidget.cpp

    HEADERS += \
            mainwindow.h \
        my_polyhedron.h \
        myqglwidget.h \
        My_Halfedge_base.h \
        My_Face_base.h

    FORMS += \
            mainwindow.ui

LIBS += -L/lib64 -lgmp -lCGAL

    INCLUDEPATH +=/usr/include

the problem is solved when I remove INCLUDEPATH +=/usr/include from .pro file
but another errors are appears about reaching CGAL :

/usr/include/boost/graph/detail/adjacency_list.hpp:1755:5: note:   template argument deduction/substitution failed:
../try_gui/my_polyhedron.cpp:203:78: note:   ‘Surface {aka CGAL::Polyhedron_3<CGAL::Simple_cartesian<double> >}’ is not derived from ‘const boost::adj_list_helper<Config, Base>’
              .edge_index_map  (boost::get(CGAL::edge_external_index  ,surface))
                                                                              ^
../try_gui/my_polyhedron.cpp: In member function ‘void My_Polyhedron::drawTree(MyQGLWidget*, int)’:
../try_gui/my_polyhedron.cpp:329:27: error: ‘class CGAL::Kd_tree_node<CGAL::Search_traits_3<CGAL::Simple_cartesian<double> >, CGAL::Fair<CGAL::Search_traits_3<CGAL::Simple_cartesian<double> >, CGAL::Plane_separator<double> >, CGAL::Boolean_tag<true> >’ has no member named ‘size’
             if(leaves[i]->size() < 1) continue;
                           ^~~~
../try_gui/my_polyhedron.cpp:331:52: error: ‘class CGAL::Kd_tree_node<CGAL::Search_traits_3<CGAL::Simple_cartesian<double> >, CGAL::Fair<CGAL::Search_traits_3<CGAL::Simple_cartesian<double> >, CGAL::Plane_separator<double> >, CGAL::Boolean_tag<true> >’ has no member named ‘begin’
             Tree::Point_d_iterator it = leaves[i]->begin();

n file included from /usr/include/CGAL/subdivision_method_3.h:31:0,
                 from ../try_gui/my_polyhedron.cpp:6:
/usr/include/CGAL/Subdivision_method_3/subdivision_methods_3.h: In instantiation of ‘void CGAL::Subdivision_method_3::Sqrt3_subdivision(PolygonMesh&, int) [with PolygonMesh = My_Polyhedron]’:
../try_gui/my_polyhedron.cpp:175:60:   required from here
/usr/include/CGAL/Subdivision_method_3/subdivision_methods_3.h:236:16: error: no type named ‘type’ in ‘struct boost::property_map<My_Polyhedron, boost::vertex_point_t, void>’
   Sqrt3(pmesh, Sqrt3_mask_3<PolygonMesh>(&pmesh, get(vertex_point,pmesh)), step);

any help please?

n.m
  • 485
  • 1
  • 5
  • 15
  • can u show the code ? if it is too big then can u recreate the problem with small code and post it here ? –  Sep 27 '18 at 08:52
  • It looks like you posted the same problem, and your solution, twice back in July. – molbdnilo Sep 27 '18 at 08:59
  • @molbdnilo yes the problem solved by removing INCLUDEPATH +=/usr/include but it causes another errors about reaching CGAL files – – n.m Sep 27 '18 at 10:37
  • Then ask about that error "about reaching CGAL files". Having `-isystem` in LIBS is a horrible hack. – Marc Glisse Sep 27 '18 at 16:11
  • @MarcGlisse I updated the post – n.m Oct 01 '18 at 12:02

2 Answers2

4

I solve the proble by adding QMAKE_CFLAGS_ISYSTEM = -I

to .pro file

n.m
  • 485
  • 1
  • 5
  • 15
1

Remove Last line

INCLUDEPATH +=/usr/include

in .pro file

If this does not work try running qmake again

  • it solves the problem but it causes another errors about reaching CGAL files – n.m Sep 27 '18 at 10:36
  • @n.m this is the rezone why I use cmake .Just declare each class in separate file and you won't ever need qmake (unless you r targeting something other than desktop) –  Sep 27 '18 at 12:01
  • I don't use cmake , I'm runing the project using qt-creator – n.m Sep 27 '18 at 12:23
  • @n.m The Beauty of Qt creator is that it can work with CMAKE . I use Qt Creator with cmake all the time –  Sep 27 '18 at 16:23
  • Why don't you describe us the "other errors about reaching CGAL" files ? – Andreas Fabri Sep 28 '18 at 05:53