I have to use mat.h for open a .mat file in my C++ code. My code is that:
#include "mat.h"
using namespace std;
int main() {
MATFile *pmat;
pmat = matOpen("ns3Da.mat","r");
return 0;
}
The command I use to compile is that:
g++ program.cpp -I/usr/local/MATLAB/R2012a/extern/include -L/usr/local/MATLAB/R2012a/bin/* -L/usr/local/MATLAB/R2012a/extern/lib -o program
The error I obtain is that:
/tmp/ccSWqTnb.o: In function 'main':
programma_c.cpp:(.text+0x13): undefined reference to 'matOpen'
collect2: error: ld returned 1 exit status
I use Linux Ubuntu 16.04 LTS and Matlab 2012a version.
How can I resolve this error?
-lmat
to the build command – StoryTeller - Unslander Monica