Using ifstream in VS2015

asked 2016-08-17 07:12:32 -0600

MRDaniel gravatar image

updated 2016-08-17 07:17:31 -0600

Hello,

I am calling a function from OpenCV that uses ifstream in C++. ifstream doesn't seem to work when tried in isolation.

Ptr<ERFilter> er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"), 8, 0.00015f, 0.13f, 0.2f, true, 0.1f);

But getting.....

OpenCV Error: Bad argument (Default classifier file not found!) in cv::text::ERClassifierNM1::ERClassifierNM1, file ~\opencv_contrib-3.1.0\modules\text\src\erfilter.cpp, line 1039

The offending line is.....

 if (ifstream(filename.c_str())) 
 { 
       .. Stuff works ....
 } 
 else 
 { 
       error!!
 }

Everything worked in VS2013 but i have to switch to VS2015.

I cannot get ifstream to work at all, even though the file is located in the .exe folder itsself or project directory. Everywhere really.

It's like ifstream has stopped working during the switch to VS2015

https://github.com/opencv/opencv_cont...

I have also tried the full path and adding files to VS2015 project resources folder.

edit retag flag offensive close merge delete

Comments

hey, it simply did not find the xml file..

it's a simple path/setup problem, nothing about ifstreams or compiler versions.

berak gravatar imageberak ( 2016-08-18 00:39:50 -0600 )edit