c++ - Error: use of deleted function std::basic_ofstream (OpenCV and C++11) -


this question has answer here:

i'm trying import project wrote time ago under windows using c++11 , opencv giving me troubles , can't figure out why. makefile project , added line enable c++11 support. however, when i'm trying run "make" or run project in eclipse receive following error (and few others)

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 

my code looks this:

#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); ... 

i think problem opencv not using c++11, possible? how fix that? i'm pretty sure code working on windows machine without problems.

thank much!

the line

save_file = std::ofstream(path_temp, std::fstream::app); 

should invoke move operator=, since rhs prvalue. in principle should work. however, there seems bug in gcc < 5.0 implementations,

why can't move std::ofstream?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -