MATLAB Answers

1

Compiling issues with Intan RHD2000 toolbox in Matlab 2017a

Asked by Franz Weber on 20 Sep 2017
Latest activity Commented on by Stuart Maitland on 2 Nov 2018
I cannot get the following driver setup to execute and I also get an error:
>> driver = rhd2000.Driver()
Warning: Message from C preprocessor:
C:\Program Files\MATLAB\R2017a\toolbox\local\rhd2000 matlab toolbox\+rhd2000\RHD2000Toolbox.h:10:9:
warning: #pragma once in main file
#pragma once
^
> In loadlibrary
In rhd2000.Driver (line 36)
Warning: Warnings messages were produced while parsing. Check the functions you intend to use for
correctness. Warning text can be viewed using:
[notfound,warnings]=loadlibrary(...)
> In loadlibrary
In rhd2000.Driver (line 36)
Error loading library intermediate output follows.
The actual error is at the end of this output.
*********
Failed to parse type '( __cdecl__ )) Close ( BOARDREF boardRef' original input '( __cdecl__ )) Close ( BOARDREF boardRef '
Found on line 24 of input from line 28 of file C:\\Program Files\\MATLAB\\R2017a\\toolbox\\local\\rhd2000 matlab toolbox\\+rhd2000\\RHD2000Toolbox.h
Error parsing argument for function __attribute__ function may be invalid.
Failed to parse type '( __cdecl__ )) Configure16DigitalOutputs ( BOARDREF boardRef' original input '( __cdecl__ )) Configure16DigitalOutputs ( BOARDREF boardRef '
Found on line 29 of input from line 33 of file C:\\Program Files\\MATLAB\\R2017a\\toolbox\\local\\rhd2000 matlab toolbox\\+rhd2000\\RHD2000Toolbox.h
Error parsing argument for function __attribute__ function may be invalid.
Failed to parse type '( __cdecl__ )) EndImpedanceMeasurement ( BOARDREF boardRef' original input '( __cdecl__ )) EndImpedanceMeasurement ( BOARDREF boardRef '
Found on line 79 of input from line 83 of file C:\\Program Files\\MATLAB\\R2017a\\toolbox\\local\\rhd2000 matlab toolbox\\+rhd2000\\RHD2000Toolbox.h
Error parsing argument for function __attribute__ function may be invalid.
.
.
.
*********
Error using loadlibrary
Building RHD2000m_thunk_pcwin64 failed. Compiler output is:
C:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\mingw_492.instrset\bin\gcc -I"C:\Program
Files\MATLAB\R2017a\extern\include" -fexceptions -fno-omit-frame-pointer
-I"C:\Users\WeberChungPC_03\Downloads" -I"C:\Program Files\MATLAB\R2017a\toolbox\local\rhd2000 matlab
toolbox\+rhd2000" "RHD2000m_thunk_pcwin64.c" -o "RHD2000m_thunk_pcwin64.dll" -shared
RHD2000m_thunk_pcwin64.c:33:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token
EXPORT_EXTERN_C long long(__cdecl__))Close(BOARDREFboardRefThunk(void fcn(),const char *callstack,int
stacksize)
^
RHD2000m_thunk_pcwin64.c:42:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token
EXPORT_EXTERN_C long long(__cdecl__))Configure16DigitalOutputs(BOARDREFboardRefThunk(void fcn(),const
char *callstack,int stacksize)
^
RHD2000m_thunk_pcwin64.c:51:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token
EXPORT_EXTERN_C long long(__cdecl__))EndImpedanceMeasurement(BOARDREFboardRefThunk(void fcn(),const char
*callstack,int stacksize)
^
RHD2000m_thunk_pcwin64.c:60:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token
EXPORT_EXTERN_C long long(__cdecl__))Stop(BOARDREFboardRefThunk(void fcn(),const char *callstack,int
stacksize)
^
RHD2000m_thunk_pcwin64.c:69:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token
EXPORT_EXTERN_C long long(__cdecl__))RunContinuously(BOARDREFboardRefThunk(void fcn(),const char
*callstack,int stacksize)
^
.
.
.
Error in rhd2000.Driver (line 36)
loadlibrary(dll, '+rhd2000\RHD2000Toolbox.h', 'alias', 'RHD2000m');
I omitted parts of the error. I am currently using MinGW for compiling. Oddly, this works flawlessly with Matlab 2015b with lcc-win32 compiler. I would like to solve this problem asap. Please help!

  0 Comments

Sign in to comment.

2 Answers

Answer by Myrtle42
on 29 May 2018

I had the same error and installed the Microsoft Visual Studio 2015 (Community) SDK -- make sure you select the option for C/C++/Matlab during installation (I forget which one it was, but it was not the default option). https://www.visualstudio.com/vs/older-downloads/

  0 Comments

Sign in to comment.


Answer by Faheem Ershad on 3 May 2018

I'm having this exact same problem. I've installed the MinGW64 Compiler (C++) and Windows 10 SDK. Prior to running the lines that you run when you get that error, I first run:
>> mbuild -setup -client mbuild_com MBUILD_COM configured to use 'MinGW64 Compiler with Windows 10 SDK or later (C++)' for C++ language compilation.
Then I run this part:
>> mex -setup cpp MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. You will be required to update your code to utilize the new API. You can find more information about this at: https://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different C++ compiler, select one from the following: MinGW64 Compiler (C++) mex -setup:C:\Users\fahee\AppData\Roaming\MathWorks\MATLAB\R2018a\mex_C++_win64.xml C++ MinGW64 Compiler with Windows 10 SDK or later (C++) mex -setup:'C:\Program Files\MATLAB\R2018a\bin\win64\mexopts\mingw64_g++_sdk10+.xml' C++ Renamed options file 'C:\Users\fahee\AppData\Roaming\MathWorks\MATLAB\R2018a\mex_C++_win64.xml' to 'C:\Users\fahee\AppData\Roaming\MathWorks\MATLAB\R2018a\mex_C++_win64_backup.xml'. MEX configured to use 'MinGW64 Compiler with Windows 10 SDK or later (C++)' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. You will be required to update your code to utilize the new API. You can find more information about this at: https://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
After that, I choose MinGW64 Compiler with Windows 10 SDK or later (C++). Then I run the line that you ran: >> driver = rhd2000.Driver();
I get the same error. Anyone have any ideas?

  1 Comment

I followed all these steps and was still receiving an error- I was able to get past this by setting the C compiler to Microsoft Visual C++ 2015 (C):
mex -setup
and selecting Microsoft Visual C++ 2015 (C) as well as mex -setup cpp as detailed above.

Sign in to comment.