如何将 CGAL 包含到 QT Creator 中的 QT 项目中?

发布于 2024-12-21 10:42:02 字数 153 浏览 2 评论 0原文

我正在尝试将 CGAL 中的一些示例代码作为 Qt 项目运行,以便在 Qt Creator 中运行。我预计我必须修改 .pro 文件。应该如何修改才能使用CGAL库?

I am trying to run some of the sample example code from CGAL as a Qt project, to run in Qt Creator. I expect that I will have to modify the .pro file. How should it be modified to use CGAL libraries?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

神回复 2024-12-28 10:42:02

我对 CGAL 并不熟悉,但一般,您需要将以下内容添加到您的 .pro 文件中:

INCLUDEPATH += /path/to/cgal/headers

LIBS += -Lpath/to/cgal/libraries -lcgal_dll_name

您可能还需要添加一些 DEFINES 如果 CGAL 需要它,即

DEFINES += SOME_MACRO_THAT_CGAL_REQUIRES

如果您专门在 CGAL 上寻求帮助,请澄清您的问题,我将删除此答案。

I'm not familiar with CGAL specifically, but in general, you would need to add the following to your .pro file:

INCLUDEPATH += /path/to/cgal/headers

LIBS += -Lpath/to/cgal/libraries -lcgal_dll_name

You may also need to add some DEFINES if CGAL requires it, i.e.

DEFINES += SOME_MACRO_THAT_CGAL_REQUIRES

If you were looking for help on CGAL specifically, please clarify your question and I will delete this answer.

橘香 2024-12-28 10:42:02

虽然这是一个老问题,但为了获得更完整的答案,这就是我必须在 .pro 文件中执行的操作:

INCLUDEPATH +=   /usr/include/
LIBS        += -L/usr/include/
LIBS        += -lCGAL
LIBS        += -lgmp
LIBS        += -lmpfr // not really needed for me, but added since gmp had to be added too
QMAKE_CXXFLAGS += -frounding-math -O3

不要不要添加如下内容,它会让你遇到奇怪的错误消息的麻烦,如 此链接

INCLUDEPATH +=   /usr/include/CGAL # do NOT add this!
LIBS        += -L/usr/include/CGAL # do NOT add this!

Although this is an old question, just for the sake of having a more complete answer, this is what I had to do in the .pro file:

INCLUDEPATH +=   /usr/include/
LIBS        += -L/usr/include/
LIBS        += -lCGAL
LIBS        += -lgmp
LIBS        += -lmpfr // not really needed for me, but added since gmp had to be added too
QMAKE_CXXFLAGS += -frounding-math -O3

Do NOT add stuff like the following, it will get you into trouble with weird error messages, as discussed in this link.

INCLUDEPATH +=   /usr/include/CGAL # do NOT add this!
LIBS        += -L/usr/include/CGAL # do NOT add this!
无名指的心愿 2024-12-28 10:42:02

我正在使用 Qt 4.8.6、gcc 和 Fedora 24,这是我的 Qt-CGAL 项目的 .pro :

#-------------------------------------------------
#
# Project created by QtCreator 2017-01-08T14:50:29
#
#-------------------------------------------------    
QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = My CGAL_test
TEMPLATE = app

LIBS += -lgmp -lmpfr -lCGAL

SOURCES += main.cpp\
    mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

I'm using Qt 4.8.6, gcc and Fedora 24, and here is my .pro for Qt-CGAL projects :

#-------------------------------------------------
#
# Project created by QtCreator 2017-01-08T14:50:29
#
#-------------------------------------------------    
QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = My CGAL_test
TEMPLATE = app

LIBS += -lgmp -lmpfr -lCGAL

SOURCES += main.cpp\
    mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文