Rank: 49486 based on 0 downloads (last 30 days) and 0 files submitted
photo

Chris Karl

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Chris
Updated File Comments Rating
12 Nov 2009 SerialIO mex SerialIO is written in C and allows you to read/write to a serial or com port. Author: Lorgio Teodovich

Hi Lorgio, I gave up compiling SerialIO within matlab. Correct me if I am wrong but the maltab internal lcc compiler won't compile serialIO.cpp correctly and hence a c++ compiler should be used. I set up my vc++ compiler (Visual C++ 2008) to compile the mex file via vc++ (see http://www.icaen.uiowa.edu/~dip/lecture/C++_with_Matlab.pdf). I am getting following errors (seems some of the syntax has c slang that the c++ compiler rejects):

1><path>\visual studio 2008\projects\mexserialio\mexserialio\serialio.cpp(332) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> f:\vc++\vc\include\stdio.h(366) : see declaration of 'sprintf'
1><path>\visual studio 2008\projects\mexserialio\mexserialio\serialio.cpp(363) : error C2664: 'CreateFileW' : cannot convert parameter 1 from 'char [255]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1><path>\visual studio 2008\projects\mexserialio\mexserialio\serialio.cpp(403) : error C2664: '_beginthread' : cannot convert parameter 1 from 'unsigned int (__stdcall *)(void)' to 'void (__cdecl *)(void *)'
1> This conversion requires a reinterpret_cast, a C-style cast or function-style cast
1><path>\visual studio 2008\projects\mexserialio\mexserialio\serialio.cpp(453) : error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1><path>\visual studio 2008\projects\mexserialio\mexserialio\serialio.cpp(469) : error C2440: '=' : cannot convert from 'const mxArray *' to 'mxArray *'
1> Conversion loses qualifiers
1><path>\visual studio 2008\projects\mexserialio\mexserialio\serialio.cpp(471) : error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>Build log was saved at "file://<path>\Visual Studio 2008\Projects\mexSerialIO\mexSerialIO\Debug\BuildLog.htm"
1>mexSerialIO - 5 error(s), 1 warning(s)

Any ideas? Feedback highly appreciated. In the original code, sleep was written lower case. Changing e.g. 'sleep(5)' to 'Sleep(5)' removed 3 errors.... quite picky compiler....

Thanks a lot!

Chris

Contact us at files@mathworks.com