简体   繁体   中英

Problem using GenTL.h: Can't find the corresponding library in GenIcam Package

I'm working on a C++ console application that allows communication with GenICam compliant industrial cameras. I installed the latest GenICam package and integrated it in my project. First I got the error message C1083: Cannot open "GenTL.h", so I moved this header to the include folder and realized, that there is no corresponding binary. Now I get the following error message:

LNK2001 Unresolved external symboll "__imp_GCInitLib".

I'm not sure how to fix it. I guess I need to integrate a further *.lib, but I can't find any in the package. Am I missing something?

Thanks for any help!

GenICam, or rather the GenAPI only handles the enumeration, unification (between different vendors), presentation of the camera features implementing GenICam.

GenTL on the other hand abstracts the transport interface and provides a standardized set of functions to the user.

So, if you want to work with camera features (GenAPI), you first need to work with a transport layer implementation to scan for cameras and communicate with them.

Being part of a standard means that the transport layer (GenTL) at least exposes the functions listed in GenTL.h but usually a lot more. Moreover, GenTL providers are - as you correctly stated - usually shared libraries which are provided by the manufacturer, usually suffixed with .cti .

Those can be dynamically loaded and the functions then used. Here is an example using a Basler GenTL provider:

#include <GenTL.h>
#include <dlfcn.h>
#include <dirent.h>


int main(){

    // Load DLL at runtime
    void *lib = dlopen("/opt/pylon/lib/pylonCXP/bin/ProducerCXP.cti", RTLD_NOW | RTLD_DEEPBIND);

    // Declare variables with variable definitions from GenTL.h
    GenTL::PGCInitLib GCInitLib;
    GenTL::PGCCloseLib GCCloseLib;

    // Dynamically bind GenTL functions to local function calls
    *reinterpret_cast<void**>(&GCInitLib) = dlsym(lib, "GCInitLib");
    *reinterpret_cast<void**>(&GCCloseLib) = dlsym(lib, "GCCloseLib");      

    GCInitLib(); // Init GenTL provider

    // [Discover cameras, open port, load GenICam, do things]

    GCCloseLib();
}

This can then be compiled with

g++ -l ldl main.cpp -o TestGenTL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM