HBadertscher / Matlab_BaslerCamDriver

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

MATLAB: Building with 'Microsoft Windows SDK 7.1 (C++)' error #30

Open Oinkyspoinky opened 6 years ago

Oinkyspoinky commented 6 years ago

Hey guys,

currently i'm working on an engineering project where i want to use the Matlab_BaslerCamDriver package offered for the Basler USB 3.0 cams. Some further informations about the steps and the setup done by myself in the last days:

cl : Command line warning D9024 : unrecognized source file type 'Files\MATLAB\R2017b\extern\include -IC:\Program', object file assumed cl : Command line warning D9027 : source file 'Files\MATLAB\R2017b\extern\include -IC:\Program' ignored cl : Command line warning D9024 : unrecognized source file type 'Files\MATLAB\R2017b\simulink\include /DMX_COMPAT_64 /DUSE_MEX_CMD /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /O2 /Oy- /DNDEBUG C:\Basler_matlab_camdriver\basler_helper\basler_set_get.cpp /Fobasler_set_get.obj ', object file assumed cl : Command line warning D9027 : source file 'Files\MATLAB\R2017b\simulink\include /DMX_COMPAT_64 /DUSE_MEX_CMD /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /O2 /Oy- /DNDEBUG C:\Basler_matlab_camdriver\basler_helper\basler_set_get.cpp /Fobasler_set_get.obj ' ignored

Error in make (line 56) mex(flags{:},libraries{k,3},ipaths,lpaths,libraries{k,2}) % build


-----------------------------------------------------------------------------------------------------------
Actually i don't have any idea how to fix this.
Hope somebody is able to help me out with this error messages.
Thanks in advance!!!!

All the best,
André
HBadertscher commented 6 years ago

Hi Andrè

This does indeed look strange. Can you try the following things to check where the error comes from:

1) Make sure that the MEX-compiler is set up correctly. Within MATLAB, type edit([matlabroot '/extern/examples/mex/mexcpp.cpp']); This will open a C++ example by MATLAB. Copy the content of this file to a new file, located in any folder you can write to, e.g. Desktop, your Documents folder,... Name the file e.g. test_mex.cpp. Now, navigate to that folder in MATLAB, and call the following command >> mex test_mex.cpp This should give the following output:

    Building with 'Microsoft Windows SDK 7.1 (C++)'.
    MEX completed successfully.
If this happens, then your compiler is set up correctly. You can verify that the compiled function works by calling

>> mex_test(1, 2) which print some data, and not throw any errors.

2) Check all include paths. Open the make.m file, and run all code up to line 46, i.e. until lpaths = [...];. Then print the values ipaths and lpaths to the MATLAB console and check that all paths in there exist on your disk and "look" correct. I would expect the paths to look something like this:

    ipaths = ' -I"C:\program\Basler\pylon 4\include" -I"C:\program\Basler\pylon 4\genicam\library\CPP\Lib\win64_x64" -I"C:\boost_1_55_0" '
    lpaths = ' -L"C:\program\Basler\pylon 4\lib64" -L"C:\program\Basler\pylon 4\genicam\library\CPP\Lib\win64_x64" -L"C:\boost_1_55_0\lib64-msvc-10.0" '
The paths can be a bit different - the important part is that all these paths exist and contain the relevant files.

Please let me know how this works out and if you find e.g. strange/bad paths in 2).

Best, Hannes

Oinkyspoinky commented 6 years ago

Hi Hannes,

wow thank you very much for that fast answer. I will check this out on Monday next week, because unfortunatelly today i'm busy to some other tasks. I will let you know what happends to your suggested steps. I'm very interested in getting this driver package running :).

All the best, André

Oinkyspoinky commented 6 years ago

Hey,

I tried your recommended steps: 1) -> I created the C++ example as explained and compiled it with the Microsoft Windows SDK 7.1 C++ compiler via MATLAB command:
mex -setup c++ to set the compiler and mex test_mex.cpp -> It gave me the following output which told me that the MEX-compiler is set correctly: Building with 'Microsoft Windows SDK 7.1 (C++)'. MEX completed successfully. -> As soon i verified it with: mex_test(1, 2) i received the message: Undefined function or variable 'mex_test'.

2) The included paths in the variables "ipaths" and "lpaths" are existing and looking correct to me: ipaths = '-I"C:\Program Files\Basler\pylon 4\pylon\include" -I"C:\Program Files\Basler\pylon 4\genicam\library\CPP\include" -I"C:\boost_1_55_0\"'

lpaths = '-L"C:\Program Files\Basler\pylon 4\pylon\lib\x64" "C:\Program Files\Basler\pylon 4\genicam\library\CPP\Lib\win64_x64" "C:\boost_1_55_0\lib64-msvc-10.0"'

I tried both steps with MATLAB running in "normal" mode and as an administrator. I attached a screenshot of the make.m file i'm using and trying with ... maybe i made a mistake in this file during the whole testing.

All the best, André make_file_line1to41 make_file_line41to80