我对使用boost和C ++很新。我刚刚安装了Boost 1.59.0,我想使用几何库。
如果我包括FIND_PACKAGE( Boost 1.47 REQUIRED )
它会发现提升并且不会出现任何问题。如果我然后包括FIND_PACKAGE( Boost 1.47 COMPONENTS geometry REQUIRED )
我得到以下错误:
Unable to find the requested Boost libraries.
Boost version: 1.59.0
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_geometry
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
如果我在CLI中运行以下[ -f /usr/include/boost/geometry/geometry.hpp ] && echo "Found" || echo "Not found"
,我会得到Found
。所以它似乎就在那里,但CMake告诉我它不是。
我有什么误会?
只有建成的图书馆才需要COMPONENTS
。 Geometry是一个仅限标题的库,因此不需要它。您只需要找到boost标头位置。