Bad Ptr when passing a string reference as an argument

I tried to understand why the following code gives me a bad pointer to the string "filename":

Mat imread(const string& filename, int flags) { 
    // some code returning a Mat object 
}

int main() {
    string s = "test.jpg";
    imread(s, 0);
}

I debugged step by step, and all I had was that before the input the imreadline was fine (I could check every element of it), but then it was impossible to do, and the debugger blamed Bad Ptr. I'm not sure I understand why this is happening.

Just so you know, I'm using Visual Studio 2008 and OpenCV 2.2.

EDIT: I really forgot to say one important thing that was essential for me to solve this problem: I wrote this code in a .cu file, so nvcc was compiled in the first instance.

+3
source share
2 answers

, OpenCV , CUDA. imread .cpp, , CUDA, .cu .h.

, , , , , .

0

- . 1 1 . , , . , , .

: . .

+4

All Articles