Error while creating MAT files from C++

I am new to Matlab. I am working on a program which is in C and C++(IDE iam using for this is Visual Studio 2010 Pro) in which I need to use MATLAB functions (for example create and read a MAT-file). I donot have MATLAB installed on my machine.
After going through the documentation, I found out it can be done by including and linking matlab file in my project(mat.h,matrix.h,libmat.lib,libmx.lib) which I got from the MATLAB install I have on my other machine.
Following the steps directed in the documentation I got to a point where I am writing some basic code to create an mxarray and dump some values into it which is written to a MAT-file.
After compiling my code, I get an error in matrix.h saying "error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ..\matrix.h 319 Test". which points me to "typedef CHAR16_T mxChar;" in matrix.h.
I donno know if I am missing. Any help will be appreciated.
Thanks

2 Comments

Please edit your question to be more readable.
Sorry for that. I reformatted the question. Let me know if it make sense.

Sign in to comment.

Answers (1)

You need to perform the compilation/linking process using the MEX command and an options-file that ships with MATLAB. I would recommend compiling your application in MATLAB, and then deploying it to whichever machine you need it on, along with the dependent libraries. See Compiling and Linking MAT-File Programs for guidance with the compilation, linking and deployment.

Asked:

on 29 Nov 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!