0
votes

After some struggle I was able to compile the CGAL environment on Windows. For doing so I followed the description provided by CGAL, so all libraries and include files are located in c:\dev\CGAL-4.10.1

Now the time has come to use CGAL in combination with QT5 Creator. For a first test I would just like to setup a basic project that is able to compile blank code with only one CGAL include statement.

So, I created a new project in Qt5 Creator. The mainwindows.cpp has the one CGAL include statement(AABB_face_graph_triangle_primitive.h):

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <CGAL/AABB_face_graph_triangle_primitive.h>

MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::MainWindow)
{
     ui->setupUi(this);
}

MainWindow::~MainWindow()
{
     delete ui;
}

I selected AABB_face_graph_triangle_primitive.h just as an example.

  • Iteration 1:

The project file (.pro) must contain all references in order to find the .h files (and probably the .lib files?). So I added the line:

INCLUDEPATH += C:\dev\CGAL-4.10.1\include

Compiling this project gives the following error:

fatal error C1083: Cannot open include file: 'CGAL/AABB_face_graph_triangle_primitive.h': No such file or directory

Since the file really does exists, the root of this problem lies in failing to include the correct include paths. What should be added to the project file in order to compile this basic blank program?

  • Iteration 2:

I noticed that when right clicking the project name I can select 'Add Library' to auto generate statements in the .pro file. Here I selected 'External library'. For the 'Library file' I browsed to 'C:\dev\CGAL-4.10.1\build\lib\Release\CGAL_Qt5-vc140-mt-4.10.1.lib' (not sure If this is the correct one?, but it is the release folder an Qt5 is in its name?). For the 'Include Path' I browsed to 'C:\dev\CGAL-4.10.1\build\include'(also not sure?). I deselected 'linux' and 'Mac', so only 'Windows' was selected.

This generated tho following text that was auto added to the .pro file:

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../dev/CGAL-
4.10.1/build/lib/release/ -lCGAL_Qt5-vc140-mt-4.10.1
else:win32:CONFIG(debug, debug|release): LIBS += -
L$$PWD/../../../../dev/CGAL-4.10.1/build/lib/debug/ -lCGAL_Qt5-vc140-mt-
4.10.1
else:unix: LIBS += -L$$PWD/../../../../dev/CGAL-4.10.1/build/lib/ -lCGAL_Qt5-
vc140-mt-4.10.1

INCLUDEPATH += $$PWD/../../../../dev/CGAL-4.10.1/build/include
DEPENDPATH += $$PWD/../../../../dev/CGAL-4.10.1/build/include

Unfortunately, even with this 'more advanced' auto generated .pro the compilation still gives an error not finding the .h file...

Main Question: What should be provided in the .pro file to successfully compile a blank Qt5 Creator project with a simple .h CGAL include statement under Windows. Besides adding a 'INCLUDEPATH' statement, should there also be in reference to a CGAL library (.lib). If yes, how should the statement be formed and which library should be added (CGAL_Qt5-vc140-mt-4.10.1.lib || CGAL_Qt5-vc140-mt-gd-4.10.1.lib).

(I noticed that this question was already asked for a linux environment)

1

1 Answers

0
votes

Well this is a little bit embarrassing...

The solution was to right click the project name and run the qmake command.

To be complete, here is my .pro file

INCLUDEPATH += \
    C:\dev\CGAL-4.10.1\include \
    C:\dev\boost_1_65_1 \
    C:\dev\CGAL-4.10.1\build\include\


win32: LIBS += -L$$PWD/../../../../dev/CGAL-4.10.1/build/lib/ -lCGAL_Qt5-vc140-mt-4.10.1

INCLUDEPATH += $$PWD/../../../../dev/CGAL-4.10.1/include
DEPENDPATH += $$PWD/../../../../dev/CGAL-4.10.1/include