1
votes

I've build CGAL like explained here.

Everything went well.

But now, I'm using Qt Creator with CGAL.

I've included the libraries in the .pro file :

QT       += core

QT       -= gui

TARGET = TestCCGALAppliConsole
CONFIG   += console
CONFIG   -= app_bundle
CONFIG += c++11

TEMPLATE = app

INCLUDEPATH += /usr/local/include
DEPENDPATH  += /usr/local/include
LIBS        += -L/usr/local/include

macx: LIBS += -L/usr/local/lib/ -lgmp
macx: LIBS += -L/usr/local/lib/ -lmpfr
macx: LIBS += -L/usr/local/lib/ -lCGAL

SOURCES += main.cpp

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../local/CGAL-4.6/build/lib/release/ -lCGAL-vc100-mt-gd-4.6
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../local/CGAL-4.6/build/lib/debug/ -lCGAL-vc100-mt-4.6

INCLUDEPATH += $$PWD/../../../../local/CGAL-4.6/build/lib/Debug
DEPENDPATH += $$PWD/../../../../local/CGAL-4.6/build/lib/Debug

INCLUDEPATH += C:\local\CGAL-4.6\include

win32: LIBS += -L$$PWD/../../../../local/CGAL-4.6/auxiliary/gmp/lib/ -llibgmp-10

INCLUDEPATH += $$PWD/../../../../local/CGAL-4.6/auxiliary/gmp/include
DEPENDPATH += $$PWD/../../../../local/CGAL-4.6/auxiliary/gmp/include

win32: LIBS += -L$$PWD/../../../../local/CGAL-4.6/auxiliary/gmp/lib/ -llibmpfr-4

INCLUDEPATH += $$PWD/../../../../local/CGAL-4.6/auxiliary/gmp/include
DEPENDPATH += $$PWD/../../../../local/CGAL-4.6/auxiliary/gmp/include


win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0/ -lboost_system-vc100-mt-1_57
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0/ -lboost_system-vc100-mt-gd-1_57

INCLUDEPATH += $$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0
DEPENDPATH += $$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0/ -lboost_thread-vc100-mt-1_57
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0/ -lboost_thread-vc100-mt-gd-1_57

INCLUDEPATH += $$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0
DEPENDPATH += $$PWD/../../../../local/boost_1_57_0/lib64-msvc-10.0

INCLUDEPATH += C:\local\boost_1_57_0

and in my main.cpp I have :

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>

#include <iostream>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel         K;
typedef CGAL::Polyhedron_3<K, CGAL::Polyhedron_items_with_id_3>     Polyhedron;
typedef Polyhedron::Vertex_iterator                                     Vertex_iterator;

int main() {

    Polyhedron mesh;
    std::ifstream input("inner.off");

    if ( !input || !(input >> mesh) || mesh.empty() )
    {
        //Debug
        std::cerr << "Not a valid off file." << std::endl;
        return 0;
    }

    for (Vertex_iterator v = mesh.vertices_begin() ; v!= mesh.vertices_end() ; ++v )
    {
        std::cout << v->point() << std::endl;
    }

    std::cout << "Hello You" << std::endl;

    return 0;
}

when I compile (with MinGW 4.9.1 32 bit with Qt 5.4.1) I'm having this error :

C:\local\CGAL-4.6\include\CGAL\double.h:191: erreur : '_nextafter' was not declared in this scope return _nextafter(d1, d2); // works at least for VC++-7.1

I can't figure out what's wrong...

Can you help me ?

EDIT

It seems that CGAL being compiled with Visual Studio C++ Compiler 10 involves that I have to compile with this compiler and not MinGW.

So I changed compile, I'm now using Microsoft Visual C++ Compiler 10 (amd64) in Qt Creator, but it still don't work. I have an error :

impossible to open 'CGAL-vc100-mt-4.6.lib' file

Here's the complete error (sorry, french version...) :

 17:42:15: Exécution des étapes pour le projet TestCCGALAppliConsole...
 17:42:15: Configuration inchangée, étape qmake sautée.
 17:42:15: Débute : "C:\Qt\Tools\QtCreator\bin\jom.exe" 
    C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
    cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\TestCCGALAppliConsole.pdb -DUNICODE -DWIN32 -DWIN64 -DQT_CORE_LIB -I"..\TestCCGALAppliConsole" -I"." -I"\usr\local\include" -I"..\..\..\..\local\CGAL-4.6\build\lib\Debug" -I"..\..\..\..\local\CGAL-4.6\include" -I"..\..\..\..\local\CGAL-4.6\auxiliary\gmp\include" -I"..\..\..\..\local\CGAL-4.6\auxiliary\gmp\include" -I"..\..\..\..\local\boost_1_57_0\lib64-msvc-10.0" -I"..\..\..\..\local\boost_1_57_0\lib64-msvc-10.0" -I"..\..\..\..\local\boost_1_57_0" -I"..\..\..\..\Qt\qt-5.4.1-x64-msvc2010-rev1\qt-5.4.1-x64-msvc2010-rev1\include" -I"..\..\..\..\Qt\qt-5.4.1-x64-msvc2010-rev1\qt-5.4.1-x64-msvc2010-rev1\include\QtCore" -I"debug" -I"..\..\..\..\Qt\qt-5.4.1-x64-msvc2010-rev1\qt-5.4.1-x64-msvc2010-rev1\mkspecs\win32-msvc2010" -Fodebug\ @C:\Users\Raphael\AppData\Local\Temp\main.obj.1988.32.jom
 main.cpp
echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "debug\\TestCCGALAppliConsole.exe.embed.manifest">debug\TestCCGALAppliConsole.exe_manifest.rc
if not exist debug\TestCCGALAppliConsole.exe if exist debug\TestCCGALAppliConsole.exe.embed.manifest del debug\TestCCGALAppliConsole.exe.embed.manifest
if exist debug\TestCCGALAppliConsole.exe.embed.manifest copy /Y debug\TestCCGALAppliConsole.exe.embed.manifest debug\TestCCGALAppliConsole.exe_manifest.bak
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\TestCCGALAppliConsole.exe.embed.manifest /OUT:debug\TestCCGALAppliConsole.exe @C:\Users\Raphael\AppData\Local\Temp\TestCCGALAppliConsole.exe.1988.5000.jom
 LINK : fatal error LNK1104: impossible d'ouvrir le fichier 'CGAL-vc100-mt-4.6.lib'
 jom: C:\Users\Raphael\Desktop\build-TestCCGALAppliConsole-Desktop_Qt_5_4_1_MSVC2010_x64-Debug\Makefile.Debug [debug\TestCCGALAppliConsole.exe] Error 1104
 jom: C:\Users\Raphael\Desktop\build-TestCCGALAppliConsole-Desktop_Qt_5_4_1_MSVC2010_x64-Debug\Makefile [debug] Error 2
 17:42:21: Le processus "C:\Qt\Tools\QtCreator\bin\jom.exe" s'est terminé avec le code 2.
 Erreur lors de la compilation/déploiement du projet TestCCGALAppliConsole (kit : Desktop Qt 5.4.1 MSVC2010 x64)
 When executing step "Make"
 17:42:21: Temps écoulé : 00:05.
1
Does mingw provide the nextafter functionality under any name? __builtin_nextafter is the one that comes to mind, but I am not even sure it would work.Marc Glisse
How did you build CGAL exactly? Was -std=c++11 involved at any point? That would explain it (you want -std=gnu++11 instead).Marc Glisse
Wait, the instructions you are linking are for compiling CGAL with Visual Studio, and now you expect to use the result with mingw? That doesn't make sense...Marc Glisse
I'm now using Microsoft Visual C++ Compiler 10.0 (amd64) but it still don't work : impossible to open 'CGAL-vc100-mt-4.6.lib' file while with mingw the library was open...Raphael Silveira Costa

1 Answers

0
votes

Well, it's right there in your message:

when I compile (with MinGW

versus

works at least for VC++-7.1

_nextafter is a Microsoft extension used by CGAL. MinGW doesn't appear to support it.