HBadertscher / Matlab_BaslerCamDriver

A universal MATLAB driver for Basler cameras
MIT License
21 stars 5 forks source link

Compilation problem #22

Open loicdenis opened 7 years ago

loicdenis commented 7 years ago

Hello,

Thank you for sharing your library to access Basler cameras.

I tried to compile under Linux with Pylon v.4 and v.5. In both cases I had the following error:

basler_set_get.cpp: In function ‘double BaslerHelper::get_float(Pylon::CInstantCamera, const char, bool)’: basler_set_get.cpp:94:57: error: conversion from ‘GenICam::gcstring’ to non-scalar type ‘std::cxx11::string {aka std::cxx11::basic_string}’ requested std::string s_result = p_parameter->ToString();

Do you have any idea of what I am doing wrong here?

Thank you for your help,

L Denis

HBadertscher commented 7 years ago

Hi Denis,

I have an idea, what the problem could be. I have created the whole driver with Pylon 4 and it appears that Pylon 5 has some differences. As I don't have a Linux installation with Matlab and Pylon 5, I couldn't try it out, so can you please try the following:

In the file basler_set_get.cpp, in each function get_float, get_int, get_string, and get_bool, there are the following two lines:

std::string s_result = p_parameter->ToString();
printf("Read Parameter \"%s\": %s\n",s_param_name, s_result);

Please try replacing them in each of the mentioned functions by the following:

GenICam::gcstring s_result = p_parameter->ToString();
printf("Read Parameter \"%s\": %s\n",s_param_name, s_result.c_str());

I'm afraid that the same happens in line 128 of the same file, then we would need some workaround there too. But can you try what I posted above first, and see if that works?

Best, Hannes

loicdenis commented 7 years ago

Thank you very much for your answer. I tried the fix you suggested + changed the type of the output of function get_string in both the .h and .cpp file. Now, the compilation is OK. There are still problems during linking, maybe due to changes from Pylon4 to Pylon5 library (e.g., "undefined reference to `Pylon::CTlFactory::GetInstance()"). I am still trying to fix them and will let you know when I succeed.