错误:未在此范围内声明'numeric_limits'

时间:2018-04-03 14:54:50

标签: c++

我正在编译我下载的代码。使用CmakeList制作文件时,我在这行代码中收到以下错误:

VocTree::findPath(Mat &descriptor) {

    list<int> path;
    int idNode = 0;
    unsigned int numCh = _k;

    path.push_back(idNode);

    while (!isLeaf(idNode)) {

        //Search the closest sub-cluster
        int idClosest = 0;
        double minDist = numeric_limits<int>::max();

        for (size_t i = 0; i < numCh; i++) {

            int childId = idChild(idNode, i);
            int idxChild = _index[childId];
            double d = norm(descriptor, _centers.row(idxChild), _useNorm);

            if (i == 0 || d < minDist) {
                minDist = d;
                idClosest = childId;
            }

        }

        idNode = idClosest;
        path.push_back(idNode);
    }

    return path;

}

这是错误:

src/VocTree.cpp:872:26: error: ‘numeric_limits’ was not declared in this scope
         double minDist = numeric_limits<int>::max();
                          ^
src/VocTree.cpp:872:41: error: expected primary-expression before ‘int’
         double minDist = numeric_limits<int>::max();

使用了以下命名空间:

using namespace cv;
using namespace std;

1 个答案:

答案 0 :(得分:0)

您需要包含

html