Results 1 to 4 of 4

Thread: Need help accessing AVT camera (with wrapper?)!

  1. #1
    Join Date
    Dec 2011
    Location
    Jena, Germany
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Need help accessing AVT camera (with wrapper?)!

    Hello, I urgently need your help!

    I'm trying to involve an AVT Pike camera into my Qt project. When I add the libraries to my .pro-file and instantiate a CFGCamera object (gives access to camera functionalities), the programm fails link(?) and gives me following errors:

    :: error: undefined reference to '_imp__ZN9CFGCameraD1Ev'
    :: error: undefined reference to '_imp__ZN9CFGCameraD1Ev'
    :: error: undefined reference to '_imp__ZN9CFGCameraD1Ev'
    :: error: collect2: ld returned 1 exit status

    Since I use the MinGW compiler, I think that the following thread in AVT's Knowledge Base is the solution to my problems:
    FireGrab with Dev C++ and MinGW/GCC compiler

    The CFGCamera object of the MS VS C++ library FGCamera.lib could not be converted to MinGW compatible *.a library. That's why there's the C-wrapper FGWrap.dll providing the functions of the FireGrab interface to a camera handle instead of an CFGCamera object.

    The FireGrab\Lib\Extra\FGWrap.lib could be loaded to your Dev C++ project easily as shown at the modified WrapSample.
    FGCamera.lib has to be included just to initialize the module and get the nodelist.
    But even with this approach I cannot access the camera. Can somebody tell me what I am doing wrong? My .pro-file now looks like this:
    Qt Code:
    1. INCLUDEPATH += C:/FirePackage/FireGrab/Lib/Extra
    2. LIBS += C:/FirePackage/FireGrab/Lib/Extra/FGWrap.lib
    3. LIBS += C:/FirePackage/FireGrab/Lib/FGCamera.lib
    To copy to clipboard, switch view to plain text mode 
    The Lib folder contains following files:
    • FGCamara.dll
    • convert.c
    • basetype.h
    • convert.h
    • errstat.h
    • FGCamera.h
    • FGCamera.lib
    • FGCamera_omf.lib


    The Extra folder contains following files:
    • FGWrap.dll
    • Camera.h
    • FGWrap.h
    • IsoDma.h
    • FGWrap.cpp
    • FGWrap.lib
    • FGWrap_omf.lib


    My main.cpp:
    Qt Code:
    1. #include <fgcamera.h>
    2. #include <fgwrap.h>
    3.  
    4. int main(int argc, char *arbv[])
    5. {
    6. QApplication a(argc, argv);
    7. FGHandle hCamera; //this is the substitute for the CFGCamera object
    8. FGNODEINFO NodeInfo[3];
    9. UINT32 NodeCnt;
    10.  
    11. FGInitModule(NULL);
    12. FGGetNodeList(NodeInfo,3,&NodeCnt);
    13.  
    14. hCamera = NULL;
    15. FGGetCameraHandle(&hCamera,&NodeInfo[0].Guid,NULL); //here it exits
    16. ...
    17. return a.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 
    When I execute it, it exits at the mentioned line with a return value -1073741515. Since this is adapted from a sample I am pretty sure that the parameters etc. are fine. I could access the camera with MSVS2010 Express as well, no problem.

    So how do I use the wrapper? Maybe someone could test it on his system, the library can be downloaded here.
    Another possibility might be to generate a MinGW compatible library from FGCamera.dll with pexports(!?), but I don't know how to do that and if it's feasible, because AVT says it is not (see above).

    Last to mention my setup:
    Qt 4.7.0
    Qt Creator 2.0.1
    MinGW-Compiler
    Windows 7

    Sorry for cross-posting(?), but initially I picked up an old thread in the Qt-programming forum. I didn't want to bother them with newbie questions anymore.

    Thanks for your assistance.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Need help accessing AVT camera (with wrapper?)!

    The *.lib files will not work directly with MingW (the second paragraph is about Dev C++). You should find the MingW linker will work directly against the C wrapper DLL. Try this:
    Qt Code:
    1. INCLUDEPATH += C:/FirePackage/FireGrab/Lib/Extra
    2. LIBS += -LC:/FirePackage/FireGrab/Lib/Extra -lFGWrap
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to ChrisW67 for this useful post:

    emigrand (8th April 2012)

  4. #3
    Join Date
    Dec 2011
    Location
    Jena, Germany
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Need help accessing AVT camera (with wrapper?)!

    Thanks a lot Chris, that did it! Although I didn`t "fully" understand the magic behind your code. A short comment would be nice

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Need help accessing AVT camera (with wrapper?)!

    INCLUDEPATH is used during the compilation of your C++ code into object files (*.obj or *.o). Any #include "file.h" directive will potentially search through directories listed in INCLUDEPATH in order to find "file.h" if it is not in the current directory.

    LIBS controls the linking phase, where your object files are coalesced into your target executable or library. The "-L" entries specify a directory to search for named libraries (there can be several). The "-l" (lower case L) entries specify the name of libraries (*.lib or *.a) to search for routines used by your program that are not present in your program.

    C++ compilers do not generally create libraries compatible with other C++ compilers for technical reasons: which is why the C++ interface library built with MSVC is not available to you using MingW. A C-style interface is portable between compilers but, for obvious reasons, cannot export classes or other C++ constructs. The C-style interface gives you a handle-based interface in your wrapper. MingW can often use a DLL with C-style interfaces directly without a separate *.lib or *.a file: this is what has worked here.

Similar Threads

  1. Accessing Symbian Camera trough QCamera
    By daleotar in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 25th September 2011, 17:18
  2. Qt Wrapper for bzip2
    By wirasto in forum Newbie
    Replies: 11
    Last Post: 24th December 2009, 09:45
  3. wrapper of methods
    By mickey in forum General Programming
    Replies: 8
    Last Post: 15th August 2008, 15:33
  4. wrapper in C for QT
    By YuriyRusinov in forum Qt Programming
    Replies: 4
    Last Post: 29th October 2007, 20:06
  5. V4L Qt wrapper
    By scarvenger in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2007, 15:54

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.