Results 1 to 3 of 3

Thread: Program crashes, where I did wrong?

  1. #1
    Join Date
    Jun 2014
    Posts
    22

    Question Program crashes, where I did wrong?

    Hi all,

    I am new to the device and the SDK. I just want to write some simple code to list the names of the devices connected to my PC.

    Here is my code:
    Code:
        // construct a new Grabber pointer
        Grabber* pGrabber = new Grabber();
    
        // Get a list of devices
        Grabber::tVidCapDevListPtr pDevList = pGrabber->getAvailableVideoCaptureDevices();
    
        // iterate through all devices
        for(Grabber::tVidCapDevList::iterator pDev = pDevList->begin(); 
            pDev != pDevList->end(); pDev++)
        {
            std::cout<<(*pDev).getBaseName()<<std::endl;
        }
    It crashes at
    Code:
    pDevList->begin()
    I am not sure if I didn't use the smart_ptr properly or it's because of something else. Please advice. (BTW I only have one device connected on my PC at the moment.)


    Thanks very much.


    Regards,

    YZ

  2. #2
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,886

    Re: Program crashes, where I did wrong?

    Dear YZ

    You did not nothing wrong. I guess, you simply did not call InitLibrary() before you do anything else
    Code:
      InitLibrary();
      Grabber* pGrabber = new Grabber();
    
        // Get a list of devices
        Grabber::tVidCapDevListPtr pDevList = pGrabber->getAvailableVideoCaptureDevices();
    
        // iterate through all devices
        for(Grabber::tVidCapDevList::iterator pDev = pDevList->begin(); 
            pDev != pDevList->end(); pDev++)
        {
            std::cout<<(*pDev).getBaseName()<<std::endl;
        }
    Please refer to http://www.imagingcontrol.com/en_US/...nitLibrary.htm
    Best regards
    Stefan
    IC Imaging Control Support

  3. #3
    Join Date
    Jun 2014
    Posts
    22

    Re: Program crashes, where I did wrong?

    Thanks for the help Stefan, it works now.

Similar Threads

  1. Unreadable frames and wrong frame numbers written to AVI with RGB24 (using DBK21/618)
    By Ringrocket in forum Astronomy Cameras Support Forum
    Replies: 0
    Last Post: November 16, 2012, 12:32:05
  2. Why SetIntParameter is wrong ?
    By vdtk3 in forum IC Imaging Control .NET
    Replies: 3
    Last Post: November 2, 2012, 11:58:39
  3. How to compile a 64-bit C++ program in Vista?
    By marquezgab in forum IC Imaging Control C++ Class Library
    Replies: 2
    Last Post: October 30, 2009, 12:17:57
  4. is there anything wrong with my camera (DMk 21AF04)?
    By valentin_0 in forum IC Imaging Control .NET
    Replies: 6
    Last Post: October 9, 2007, 15:56:43
  5. Wrong Gray Scale
    By Unregistered in forum IC Imaging Control .NET
    Replies: 1
    Last Post: June 6, 2005, 11:08:20

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •