gpt4 book ai didi

c++ - 无法在 Mac 中使用 Boost + Qt

转载 作者:行者123 更新时间:2023-11-28 02:16:24 25 4
gpt4 key购买 nike

我通过 home-brew 在运行 Yosemite 的 iMac 上安装了 Boost

我正在尝试运行一个使用 Boost 的代码,在 Qt4 中运行它,但我遇到了一堆错误:

enter image description here

示例:

In file included from ../TLCVis/main.cpp:31:
In file included from ../TLCVis/global.h:33:
In file included from ../TLCVis/querymanager.h:33:
In file included from ../TLCVis/KdTrip.hpp:38:
In file included from /usr/local/include/boost/iostreams/device/mapped_file.hpp:20:
In file included from /usr/local/include/boost/iostreams/close.hpp:18:
In file included from /usr/local/include/boost/iostreams/flush.hpp:17:
In file included from /usr/local/include/boost/iostreams/detail/dispatch.hpp:17:
In file included from /usr/local/include/boost/iostreams/traits.hpp:39:
In file included from /usr/local/include/boost/range/iterator_range.hpp:13:
In file included from /usr/local/include/boost/range/iterator_range_core.hpp:27:
/usr/local/include/boost/iterator/iterator_facade.hpp:890:3: warning: unused typedef 'boost_static_assert_typedef_890' [-Wunused-local-typedef]
BOOST_ITERATOR_FACADE_RELATION(==, return, equal)
^
/usr/local/include/boost/iterator/iterator_facade.hpp:883:3: note: expanded from macro 'BOOST_ITERATOR_FACADE_RELATION'
BOOST_ITERATOR_FACADE_INTEROP( \
^
/usr/local/include/boost/iterator/iterator_facade.hpp:872:7: note: expanded from macro 'BOOST_ITERATOR_FACADE_INTEROP'
BOOST_STATIC_ASSERT(( \
^
/usr/local/include/boost/static_assert.hpp:170:16: note: expanded from macro 'BOOST_STATIC_ASSERT'
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN'
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
^
/usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2'
#define BOOST_DO_JOIN2( X, Y ) X##Y
^
<scratch space>:95:1: note: expanded from here
boost_static_assert_typedef_890
^
In file included from ../TLCVis/main.cpp:31:
In file included from ../TLCVis/global.h:33:
In file included from ../TLCVis/querymanager.h:33:
In file included from ../TLCVis/KdTrip.hpp:38:
In file included from /usr/local/include/boost/iostreams/device/mapped_file.hpp:20:
In file included from /usr/local/include/boost/iostreams/close.hpp:18:
In file included from /usr/local/include/boost/iostreams/flush.hpp:17:
In file included from /usr/local/include/boost/iostreams/detail/dispatch.hpp:17:
In file included from /usr/local/include/boost/iostreams/traits.hpp:39:
In file included from /usr/local/include/boost/range/iterator_range.hpp:13:
In file included from /usr/local/include/boost/range/iterator_range_core.hpp:27:
/usr/local/include/boost/iterator/iterator_facade.hpp:891:3: warning: unused typedef 'boost_static_assert_typedef_891' [-Wunused-local-typedef]
BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
^
/usr/local/include/boost/iterator/iterator_facade.hpp:883:3: note: expanded from macro 'BOOST_ITERATOR_FACADE_RELATION'
BOOST_ITERATOR_FACADE_INTEROP( \
^
/usr/local/include/boost/iterator/iterator_facade.hpp:872:7: note: expanded from macro 'BOOST_ITERATOR_FACADE_INTEROP'
BOOST_STATIC_ASSERT(( \
^
/usr/local/include/boost/static_assert.hpp:170:16: note: expanded from macro 'BOOST_STATIC_ASSERT'
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN'
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
^
/usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2'
#define BOOST_DO_JOIN2( X, Y ) X##Y
^
<scratch space>:97:1: note: expanded from here
boost_static_assert_typedef_891
^
In file included from ../TLCVis/main.cpp:31:
In file included from ../TLCVis/global.h:33:
In file included from ../TLCVis/querymanager.h:33:
In file included from ../TLCVis/KdTrip.hpp:38:
In file included from /usr/local/include/boost/iostreams/device/mapped_file.hpp:20:
In file included from /usr/local/include/boost/iostreams/close.hpp:18:
In file included from /usr/local/include/boost/iostreams/flush.hpp:17:
In file included from /usr/local/include/boost/iostreams/detail/dispatch.hpp:17:
In file included from /usr/local/include/boost/iostreams/traits.hpp:39:
In file included from /usr/local/include/boost/range/iterator_range.hpp:13:
In file included from /usr/local/include/boost/range/iterator_range_core.hpp:27:
/usr/local/include/boost/iterator/iterator_facade.hpp:920:3: warning: unused typedef 'boost_static_assert_typedef_920' [-Wunused-local-typedef]
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from)
^
/usr/local/include/boost/iterator/iterator_facade.hpp:913:3: note: expanded from macro 'BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION'
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
^
/usr/local/include/boost/iterator/iterator_facade.hpp:900:7: note: expanded from macro 'BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS'
BOOST_STATIC_ASSERT(( \
^
/usr/local/include/boost/static_assert.hpp:170:16: note: expanded from macro 'BOOST_STATIC_ASSERT'
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN'
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
^
/usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2'
#define BOOST_DO_JOIN2( X, Y ) X##Y
^
<scratch space>:99:1: note: expanded from here
boost_static_assert_typedef_920
^
In file included from ../TLCVis/main.cpp:31:
In file included from ../TLCVis/global.h:33:
In file included from ../TLCVis/querymanager.h:33:
In file included from ../TLCVis/KdTrip.hpp:38:
In file included from /usr/local/include/boost/iostreams/device/mapped_file.hpp:20:
In file included from /usr/local/include/boost/iostreams/close.hpp:18:
In file included from /usr/local/include/boost/iostreams/flush.hpp:17:
In file included from /usr/local/include/boost/iostreams/detail/dispatch.hpp:17:
In file included from /usr/local/include/boost/iostreams/traits.hpp:39:
In file included from /usr/local/include/boost/range/iterator_range.hpp:13:
In file included from /usr/local/include/boost/range/iterator_range_core.hpp:27:
/usr/local/include/boost/iterator/iterator_facade.hpp:921:3: warning: unused typedef 'boost_static_assert_typedef_921' [-Wunused-local-typedef]
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from)
^
/usr/local/include/boost/iterator/iterator_facade.hpp:913:3: note: expanded from macro 'BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION'
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
^
/usr/local/include/boost/iterator/iterator_facade.hpp:900:7: note: expanded from macro 'BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS'
BOOST_STATIC_ASSERT((

我正在互联网上进行一些搜索,但我找不到关于问题所在的线索。

.pro 文件如下所示:

QT += widgets core gui opengl webkit

#CONFIG += Debug

TARGET = TLCVis
TEMPLATE = app

DEFINES += RESOURCES_DIR=\\\"$$PWD/Resources/\\\"
DEFINES += DATA_DIR=\\\"$$PWD/../../data/\\\"

SOURCES += main.cpp\
mainwindow.cpp \
HistogramDialog.cpp \
TemporalSeriesDialog.cpp \
TimeExplorationDialog.cpp \
QMapView.cpp \
QMapWidget.cpp \
geographicalviewwidget.cpp \
global.cpp \
qcustomplot.cpp \
SelectionGraph.cpp \
Selection.cpp \
GroupRepository.cpp \
Group.cpp \
timeselectionwidget.cpp \
timewidget.cpp \
viewwidget.cpp \
coordinator.cpp \
histogramwidget.cpp \
temporalseriesplotwidget.cpp \
util/divergent.cpp \
util/colorscale.cpp \
util/yellowtobrownscale.cpp \
util/rainbowscale.cpp \
util/pseudorainbowscale.cpp \
util/locsscale.cpp \
util/lineargrayscale.cpp \
util/heatedobjectscale.cpp \
util/greentowhitescale.cpp \
util/grayscale.cpp \
util/bluetoyellowscale.cpp \
util/bluetocyanscale.cpp \
util/colorbar.cpp \
neighborhoodset.cpp \
neighborhood.cpp \
util/scalar.cpp \
neighborhoodgraph.cpp \
extendedplotwidget.cpp \
RenderingLayer.cpp \
layers/GridMap.cpp \
layers/HeatMap.cpp \
layers/Triangulator.cpp \
layers/TripAnimation.cpp \
layers/TripLocation.cpp \
layers/TripLocationLOD.cpp \
scatterplotwidget.cpp \
util/sequentialred.cpp \
extendedhistogram.cpp \
querymanager.cpp

HEADERS += mainwindow.h \
HistogramDialog.hpp \
TemporalSeriesDialog.hpp \
TimeExplorationDialog.hpp \
QMapView.hpp \
QMapWidget.hpp \
layers/GridMap.hpp \
layers/HeatMap.hpp \
layers/TripAnimation.hpp \
layers/TripLocation.hpp \
layers/TripLocationLOD.hpp \
geographicalviewwidget.h \
KdTrip.hpp \
global.h \
qcustomplot.h \
SelectionGraph.h \
Selection.h \
UsefulGeometryFunctions.h \
GroupRepository.h \
Group.h \
timeselectionwidget.h \
timewidget.h \
viewwidget.h \
coordinator.h \
histogramwidget.h \
temporalseriesplotwidget.h \
util/divergent.h \
util/colorscale.h \
util/yellowtobrownscale.h \
util/rainbowscale.h \
util/pseudorainbowscale.h \
util/locsscale.h \
util/lineargrayscale.h \
util/heatedobjectscale.h \
util/greentowhitescale.h \
util/grayscale.h \
util/bluetoyellowscale.h \
util/bluetocyanscale.h \
util/colorbar.h \
neighborhoodset.h \
neighborhood.h \
util/scalar.h \
neighborhoodgraph.h \
extendedplotwidget.h \
scatterplotwidget.h \
util/sequentialred.h \
extendedhistogram.h \
querymanager.h

FORMS += mainwindow.ui \
timeselectionwidget.ui \
timewidget.ui \
viewwidget.ui \
histogramwidget.ui \
temporalseriesplotwidget.ui \
layers/TripAnimationConfig.ui \
layers/TripAnimationToolBar.ui \
scatterplotwidget.ui \
HistogramDialog.ui \
TemporalSeriesDialog.ui \
TimeExplorationDialog.ui

INCLUDEPATH += /usr/local/include/

LIBS += -L/usr/local/lib -lGLEW
LIBS += -L/usr/local/lib -lboost_iostreams -lboost_system -lboost_filesystem

RESOURCES += \
resources.qrc

我被告知代码在 Linux 系统中运行正常。

最佳答案

您似乎将警告视为错误,而 Boost 目前有一个 Unresolved 问题,即 BOOST_STATIC_ASSERT 在 GCC 和 Clang 上导致警告:

https://svn.boost.org/trac/boost/ticket/7242

临时解决方法是在行为不当的系统上添加 -Wno-unused-local-typedefs

另见:

gnu gcc How to suppress warning: ‘typedef’ was ignored in this declaration [enabled by default]

关于c++ - 无法在 Mac 中使用 Boost + Qt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33877707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com