C++ 错误:…受保护的函数

C++ 错误:…受保护的函数,c++,compiler-construction,compiler-errors,flann,C++,Compiler Construction,Compiler Errors,Flann,我试图使用另一个代码包中的Make方法编译flann,但在其中一个flann二进制文件“/flann/util/matrix.h:75”中遇到了关于受保护函数的错误 有人能帮我纠正这个错误吗? 我真的是一个编程新手,请尽量简单P g++ -I. -Iflann/src/cpp -c -o src/main.o src/main.cpp In file included from ./boost/asio/async_result.hpp:18, from ./boost

我试图使用另一个代码包中的Make方法编译flann,但在其中一个flann二进制文件“/flann/util/matrix.h:75”中遇到了关于受保护函数的错误 有人能帮我纠正这个错误吗? 我真的是一个编程新手,请尽量简单P

g++ -I. -Iflann/src/cpp -c -o src/main.o src/main.cpp
In file included from ./boost/asio/async_result.hpp:18,
             from ./boost/asio.hpp:20,
             from src/common.hpp:30,
             from src/main.cpp:9:
./boost/asio/detail/config.hpp:367:5: warning: #warning Please define _WIN32_WIN NT or _WIN32_WINDOWS appropriately.
./boost/asio/detail/config.hpp:368:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
./boost/asio/detail/config.hpp:369:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
./flann/util/matrix.h: In function 'int cbir::main(int, char**)':
./flann/util/matrix.h:75: error: 'flann::uchar* flann::Matrix_::data' is protected
src/main.cpp:39: error: within this context
Makefile:43: recipe for target `src/main.o' failed
make: *** [src/main.o] Error 1
这是矩阵h:

#ifndef FLANN_DATASET_H_
#define FLANN_DATASET_H_

#include "flann/general.h"
#include <stdio.h>

namespace flann
{

typedef unsigned char uchar;

class Matrix_
{
public:

 Matrix_() : rows(0), cols(0), stride(0), data(NULL)
 {
 };

     Matrix_(void* data_, size_t rows_, size_t cols_, flann_datatype_t type, size_t stride_ = 0) :
          rows(rows_), cols(cols_),  stride(stride_)
    {
          data = static_cast<uchar*>(data_);
          if (stride==0) stride = flann_datatype_size(type)*cols;
    }

    inline void* operator[](size_t index) const
    {
          return data+index*stride;
    }

    void* ptr() const
    {
          return data;
    }

    size_t rows;
    size_t cols;
    size_t stride;
    flann_datatype_t type;
protected:
    uchar* data;

};

template <typename T>
class Matrix : public Matrix_
{
public:
    typedef T type;

    Matrix() : Matrix_()
    {
    }

    Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) :
        Matrix_(data_, rows_, cols_, flann_datatype<T>::value, stride_)
    {
    }

    FLANN_DEPRECATED void free()
    {
           fprintf(stderr, "The flann::Matrix<T>::free() method is deprecated "
                  "and it does not do any memory deallocation any more.  You are"
                  "responsible for deallocating the matrix memory (by doing"
                  "'delete[] matrix.ptr()' for example)");
    }

    inline T* operator[](size_t index) const
{
    return reinterpret_cast<T*>(static_cast<uchar*>(Matrix_::data)+index*stride);
//      return (T*)(Matrix_::operator [](index));
}

    T* ptr() const
    {
            return reinterpret_cast<T*>(Matrix_::data);
    }
};

}

#endif //FLANN_DATASET_H_
\ifndef FLANN\u数据集\u H_
#定义法兰数据集_
#包括“法兰/一般h”
#包括
名称空间法兰
{
typedef无符号字符;
类矩阵_
{
公众:
矩阵(0):行(0)、列(0)、步长(0)、数据(NULL)
{
};
矩阵(无效*数据、大小行、大小列、法兰数据类型、大小跨步=0):
行(行),列(列),跨步(跨步)
{
数据=静态_转换(数据_);
如果(步幅==0)步幅=flann\u数据类型\u大小(类型)*cols;
}
内联void*运算符[](大小索引)常量
{
返回数据+索引*步幅;
}
void*ptr()常量
{
返回数据;
}
行大小;
尺码;
步幅大小;
法兰数据类型;
受保护的:
uchar*数据;
};
模板
类矩阵:公共矩阵_
{
公众:
T型;
矩阵():矩阵
{
}
矩阵(T*数据、大小、行、大小、列、大小、步幅=0):
矩阵(数据、行、列、法兰数据类型::值、跨步)
{
}
FLANN_不推荐使用的无空格()
{
fprintf(stderr,“flann::Matrix::free()方法已被弃用”
“而且它不再执行任何内存释放。您是”
“负责释放矩阵内存(通过执行以下操作)”
“'delete[]matrix.ptr()'例如)”;
}
内联T*运算符[](大小索引)常量
{
返回重新解释转换(静态转换(矩阵::数据)+索引*步幅);
//返回(T*)(矩阵_uz::运算符[](索引));
}
T*ptr()常数
{
返回重新解释转换(矩阵::数据);
}
};
}
#endif//FLANN\u数据集_

您应该使用
矩阵
而不是非类型化的
矩阵
类。然后,您可以使用
ptr
获取指向数据的类型指针,或者使用
[]
操作符获取对特定元素的访问。

如果只给出一些编译器错误提示,没有人知道发生了什么。粘贴一些代码片段会更好。我在谷歌上找不到一个版本的
matrix.h
有可疑的第75行或受保护的
数据
属性。你能发布你的一部分(或整个文件的链接)吗?