Building a mat file with a QT application

I have some c++ QT code I would like to use to write data for a .mat file. I have included in the .pro (QT project file) file:
WIN32:LIBS += \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libeng.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libma.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libmex.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libmwblas.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libmqblascompat32.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libmxlapack.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libmwmathutil.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libmx.lib" \
"C:/Program Files/MATLAB/R2010b/extern/lib/win64/microsoft/libut.lib"
I have also included the header files from the examples on mat file writing in the MATLAB installation. For some reason the compiler is not able to find the mat file functions. The error messages are similar to this:
undefined reference to `matOpen'
The only thing I can think of at this point is that the .lib files are compiler specific and won't work with the QT Creator compiler?
If anyone has any suggestions or experience I would really appreciate it.
Thanks in advance

Réponses (2)

Walter Roberson
Walter Roberson le 3 Mar 2011

0 votes

.lib files should not be compiler specific (well, not under normal circumstances), but they would be specific about whether they are 32 bit or 64 bit libraries. I believe the ones you list are 64 bit libraries (/win64 subdirectory), but your comment says WIN32 which would be for 32 bit libraries. One or more of us is confused ;-)

1 commentaire

Alex
Alex le 3 Mar 2011
You're right, that should be WIN64. Unfortunately that doesn't fix the problem. I have tried several different combinations of LIBS, WIN32:LIBS, -L"<path>".
Thanks for your help, but do you have any other ideas?

Connectez-vous pour commenter.

Kaustubha Govind
Kaustubha Govind le 3 Mar 2011

0 votes

One good way to figure out if you're using all the right compiler options is to use the engmatopts.bat option file discussed here, compile with the mex -v (verbose) option to see the exact compiler/linker commands.

1 commentaire

Zeljko
Zeljko le 6 Oct 2013
That may be useful when compiling through mex with other compilers, but we are trying to compile within a Qt environment and as far as I can tell, mex has no role there.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange

Question posée :

le 3 Mar 2011

Commenté :

le 6 Oct 2013

Community Treasure Hunt

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

Start Hunting!

Translated by