64bit Linux opening .mat file in C: library not linking
이전 댓글 표시
Hello,
I am trying to open a .mat file in C, but I am having lots of trouble. The code I am running is simple for now:
---------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include "mat.h"
int main(int argc, char **argv)
{
MATFile *spikemat;
const char* name = NULL;
mxArray *reader;
spikemat = matOpen("./data/dataset.mat", "r");
if (spikemat == NULL)
{
printf("Error Opening File");
return();
}
matClose(spikemat);
return 0;
}
-------------------------------------------
However I am getting the following error when trying to compile using "gcc ptsp_detect.c -I /usr/local/MATLAB/R2010b/extern/include" (-I argument is where the header files are located):
In function `main': ptsp_detect.c:(.text+0x22): undefined reference to `matOpen' ptsp_detect.c:(.text+0x52): undefined reference to `matClose' collect2: ld returned 1 exit status
EVEN THOUGH when I look at my paths using echo $LD_LIBRARY_PATH, it spits out the "correct" entries according to [http://www.mathworks.se/help/techdoc/matlab_external/f19027.html].
/usr/local/MATLAB/R2010b/bin/glnxa64:/usr/local/MATLAB/R2010b/sys/os/glnxa64:
What else could be the problem here?
Thanks for any input. Phil
댓글 수: 1
philip tully
2011년 8월 29일
이동: Stefanie Schwarz
2022년 9월 13일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Naming Conventions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!