C++ and OpenCV in Visual Studio exited with code -1 (0xffffffff) error

妖精的绣舞 提交于 2019-12-11 08:29:46

问题


My code builds fine but when I debug this is what I get:

'Proj_OpenCV.exe': Loaded 'C:\Users\Saher\Documents\Visual Studio 2008\Projects\Proj_OpenCV\Debug\Proj_OpenCV.exe', Symbols loaded.
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll'
'Proj_OpenCV.exe': Loaded 'C:\Users\Saher\Downloads\OpenCV2.3\build\x86\vc9\bin\opencv_core230.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcp90.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll'
'Proj_OpenCV.exe': Loaded 'C:\Users\Saher\Downloads\OpenCV2.3\build\x86\vc9\bin\opencv_highgui230.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\user32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\comctl32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\avifil32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\msacm32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\msvfw32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\avicap32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\version.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcp90d.dll', Symbols loaded.
'Proj_OpenCV.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcr90d.dll', Symbols loaded.
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll'
'Proj_OpenCV.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll'
'Proj_OpenCV.exe': Loaded 'C:\Program Files (x86)\McAfee\SiteAdvisor\sahook.dll'
The program '[5748] Proj_OpenCV.exe: Native' has exited with code -1 (0xffffffff).

My code is as follows from the OpenCV tutorial page

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std; 

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", CV_WINDOW_AUTOSIZE );// Create a window for display.
    imshow( "Display window", image );                   // Show our image inside it.

    waitKey(0);                                          // Wait for a keystroke in the window


    return 0;
}

Any help with this error and how to resolve it will be appreciated.


回答1:


  • The application should be executed from the cmd line
  • You need to pass the name of the image as a parameter in the cmd line when you launch this application: display_image.exe test.jpg

Or, if you are executing it from Visual Studio, make sure you set the image filename at:

Project Properties > Configuration Properties > Debugging > Command Arguments


来源:https://stackoverflow.com/questions/9868210/c-and-opencv-in-visual-studio-exited-with-code-1-0xffffffff-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!