错误:使用已删除的函数std :: basic_ofstream(OpenCV和C++ 11)

use*_*804 3 c++ eclipse opencv makefile-project c++11

我正在尝试导入我之前在Windows下使用C++ 11和OpenCV编写的项目,但它给了我麻烦,我无法弄清楚为什么.这是一个MakeFile项目,我添加了一行来启用C++ 11支持.但是,当我试图在eclipse中运行"make"或运行项目时,我收到以下错误(以及其他一些错误)

use of deleted function ‘std::basic_filebuf<char>&  std::basic_filebuf<char>::operator=(const std::basic_filebuf<char>&)’   FacadeLabelingV2        line 599, external location: /usr/include/c++/4.8/fstream
Run Code Online (Sandbox Code Playgroud)

我的代码看起来像这样:

#ifndef _FILEUTIL_CPP_
#define _FILEUTIL_CPP_

#include "Configuration.h"
#include "Utilities.cpp"

#include <iostream>
#include <fstream>


static void saveFeatures(const std::pair<cv::Mat, cv::Mat>& features, const Configuration& config, bool training, bool append, int counter = 0){
    string prefix;
    if (training) {
        prefix = "train";
    } else {
        prefix = "test";
    }
    std::string directory = config.dir_classifiers + config.name_of_run;
    std::ofstream save_file;
    std::string counter_appendix = std::to_string(counter / 50);
    std::string path_temp = directory + prefix + "_features" + counter_appendix + ".txt";
    if (append){
        save_file = std::ofstream(path_temp, std::fstream::app);
...
Run Code Online (Sandbox Code Playgroud)

我认为这可能是OpenCV不使用C++ 11的问题,这可能吗?我怎么能解决这个问题?我很确定这个代码在我的Windows机器上工作没有任何问题.

非常感谢你!

vso*_*tco 8

这条线

save_file = std::ofstream(path_temp, std::fstream::app);
Run Code Online (Sandbox Code Playgroud)

应该调用移动operator=,因为rhs是一个prvalue.所以原则上应该有效.但是,gcc <5.0实现中似乎存在一个错误,

为什么我不能移动std :: ofstream?