# Revision history [back]

### Why do I get an error from imread when running my program in eclipse CDT, but not when running from terminal.

Hi guys I have had this problem for a while but I finally want to figure out how to fix it. In eclipse I can have this code:

int main(int argc, char** argv){
Mat image = imread( argv[1], 0);
namedWindow("ImageBefore",CV_WINDOW_NORMAL);
imshow("ImageBefore",image);
}


If I specify argv[1] in eclipse to be "filename.jpg" I get the following error:

OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /home/refinedcode/Development/OpenCV-2.4.2/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
what():  /home/refinedcode/Development/OpenCV-2.4.2/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat


But if I run the executable from the terminal with

./ProgramName filename.jpg


It runs fine. I can change the code to:

int main(int argc, char** argv){
const string filename "filename.jpg";