The program '[1628] ConsoleApplication3_Test.exe' has exited with code -1 (0xffffffff).

asked 2015-02-01 17:09:15 -0600

Yousif gravatar image

updated 2015-02-02 04:48:28 -0600

Hello, While Debugging the code mentioned in this link, the console window opens and closes quickly and gives me the following breakdown or error:

'ConsoleApplication3_TEST.exe' (Win32): Loaded 'C:\Users\Yousif\Documents\Visual Studio 2012\Projects\ConsoleApplication3_TEST\x64\Debug\ConsoleApplication3_TEST.exe'. Symbols loaded.
'ConsoleApplication3_TEST.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded.
'ConsoleApplication3_TEST.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
'ConsoleApplication3_TEST.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Symbols loaded.
'ConsoleApplication3_TEST.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Symbols loaded.
The program '[1628] ConsoleApplication3_TEST.exe' has exited with code -1 (0xffffffff).

Or even when debugging any of the sample codes in OpenCV\sources\samples\cpp folder it gives me the same error. Any help will be appreciated.

edit retag flag offensive close merge delete

Comments

1

look for a line like return -1; in your code ..

(it probably expected some cmdline args, or could not find resources, like images)

berak gravatar imageberak ( 2015-02-02 01:39:20 -0600 )edit

this is the code I'm testing

int main( int argc, char** argv )
{
    if( argc != 2)
    {
     cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
     return -1;
    }

    Mat image;
    image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file

    if(! image.data )                              // Check for invalid input
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }

    namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display.
    imshow( "Display window", image );                   // Show our image inside it.

when I debug it the console windows flashes, when I run it without debugging (Ctrl+F5) the console window opens with the following message Usage: display_image ImageToLoadAndDisp

Yousif gravatar imageYousif ( 2015-02-02 18:42:49 -0600 )edit

But in the "release configuration" when I run the program it gives Could not open or find the image I've put the image in the same folder with the .exe but still nthn worked.

Yousif gravatar imageYousif ( 2015-02-02 18:45:07 -0600 )edit

O it wont work by simply trying to guess the right folder where to place the file. Add the file to a known path, for example C:/test/test.jpg and than try giving that explicit path as an argument. I am guessing your system doesn't find the file.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-02-03 02:11:22 -0600 )edit

I gave it an argument, I opened cmd and wrote C:\Users\Yousif\Documents\Visual Studio 2012\Projects\x64\Release>ConsoleApplication3_TEST.exe image.png and gave me not recognized as internal or external so i tried another method which is going to visual studio and from debugging configuration I've set command arguments to the specified image but still nthn new. Is there a way that i can specify the path of the image directly from the code without setting an argument? And why the console application flashes when debugging but doesn't flash when i start the program without debugging? And in the release mode it gives me a different statement from the debugging mode? Thanks in advance.

Yousif gravatar imageYousif ( 2015-02-03 04:49:10 -0600 )edit

waitKey(0); is written at the end of the code, I read this

Warning

If you are using a 64-bit machine, you will have to modify k = cv2.waitKey(0) line as follows : k = cv2.waitKey(0) & 0xFF Is this related to the flashing console window?

Yousif gravatar imageYousif ( 2015-02-03 05:01:56 -0600 )edit
2

^^ no, you're wrong about this . the ' &0xFF' part only applies on some linux, where you get scankey values instead of ascii. (unrelated)

berak gravatar imageberak ( 2015-02-03 06:19:39 -0600 )edit
1

skip the argument phase, probably to harsh for you for now. just change image = imread(argv[1], CV_LOAD_IMAGE_COLOR); into image = imread("C:\\Users\\Yousif\\Documents\\Visual Studio 2012\\Projects\\x64\\Release\\image.png");

StevenPuttemans gravatar imageStevenPuttemans ( 2015-02-03 08:10:28 -0600 )edit
1

Ohh thanks StevenPuttemans, it worked (Y). It worked for the release configuration, but for debugging still the console window flashes unless I press Ctrl+F5. Anyway I'll skip this tutorial it took a lot of time.

Yousif gravatar imageYousif ( 2015-02-03 17:39:21 -0600 )edit