我的问题与Boost 和 OpenCV 库与 Eclipse CDR 的静态链接有关。错误,而我试图做的比这里描述的多一点:如何创建一个可以使用 Boost 和 OpenCV 读取文件夹中所有图像的程序?,即使用Boost的文件系统库遍历一个目录,并使用OpenCV对图像文件进行一些处理。
我使用 MinGW 编译了文件系统和其他库,并尝试在 Windows 7 64 位系统上使用 Eclipse CDT 运行 Boost 1.45、OpenCV 2.2 和 Eigen2。如果在项目中单独使用文件系统库,则可以毫无问题地编译和运行,但结合上面的其他两个库,我会收到以下错误:
In file included from C:\boost_1_45_0/boost/filesystem/v3/path_traits.hpp:22:0,
from C:\boost_1_45_0/boost/filesystem/v3/path.hpp:25,
from C:\boost_1_45_0/boost/filesystem.hpp:32,
from ..\src\ComputeNatScaleFunction.cpp:18:
C:\boost_1_45_0/boost/type_traits/decay.hpp: In instantiation of 'boost::decay<cv::<anonymous enum> >':
C:\cmake_binaries\include/opencv2/core/operations.hpp:766:23: instantiated from here
C:\boost_1_45_0/boost/type_traits/decay.hpp:28:66: error: 'cv::' is/uses anonymous type
C:\boost_1_45_0/boost/type_traits/decay.hpp:28:66: error: trying to instantiate 'template struct boost::remove_reference'
C:\boost_1_45_0/boost/type_traits/decay.hpp:38:17: error: 'cv::' is/uses anonymous type
C:\boost_1_45_0/boost/type_traits/decay.hpp:38:17: error: trying to instantiate 'template struct boost::remove_reference'
C:\boost_1_45_0/boost/type_traits/decay.hpp: In instantiation of 'boost::decay<cv::<anonymous enum> >':
C:\cmake_binaries\include/opencv2/core/operations.hpp:917:21: instantiated from here
C:\boost_1_45_0/boost/type_traits/decay.hpp:28:66: error: 'cv::' is/uses anonymous type
C:\boost_1_45_0/boost/type_traits/decay.hpp:28:66: error: trying to instantiate 'template struct boost::remove_reference'
C:\boost_1_45_0/boost/type_traits/decay.hpp:38:17: error: 'cv::' is/uses anonymous type
C:\boost_1_45_0/boost/type_traits/decay.hpp:38:17: error: trying to instantiate 'template struct boost::remove_reference'
C:\boost_1_45_0/boost/type_traits/decay.hpp: In instantiation of 'boost::decay<Eigen::<anonymous enum> >':
C:\Eigen2/Eigen/src/Core/GenericPacketMath.h:116:18: instantiated from here
C:\boost_1_45_0/boost/type_traits/decay.hpp:28:66: error: 'Eigen::' is/uses anonymous type
C:\boost_1_45_0/boost/type_traits/decay.hpp:28:66: error: trying to instantiate 'template struct boost::remove_reference'
C:\boost_1_45_0/boost/type_traits/decay.hpp:38:17: error: 'Eigen::' is/uses anonymous type
C:\boost_1_45_0/boost/type_traits/decay.hpp:38:17: error: trying to instantiate 'template struct boost::remove_reference'
等等
关于为什么这些库可能相互冲突的任何提示?编译器没有通过文件系统的包含(即第 18 行)。