Building a mat file with a QT application

3 views (last 30 days)
Alex
Alex on 3 Mar 2011
Commented: Zeljko on 6 Oct 2013
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

Answers (2)

Walter Roberson
Walter Roberson on 3 Mar 2011
.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 Comment
Alex
Alex on 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?

Sign in to comment.


Kaustubha Govind
Kaustubha Govind on 3 Mar 2011
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 Comment
Zeljko
Zeljko on 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.

Sign in to comment.

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!