【发布时间】:2011-06-08 05:07:29
【问题描述】:
我是 Visual Studio 和 C/C++ 的新手……虽然我曾在 MATLAB 中工作过……
我正在尝试使用 MATLAB 帮助中给出的 MAT API 加载 mat 文件,但即使对于下面给出的简单代码,它也在编译,但解决方案没有构建,并且它给出了 4 个相同类型的错误。我已经包括了所有lib 和头文件作为附加的 lib 和包含文件夹...
需要 serios 帮助...谢谢
错误 1 错误 LNK2019:未解析的外部符号 _mxFree 在函数 _main test2.obj test2 中引用
错误 2 错误 LNK2019:未解析的外部符号 _matGetVariable 在函数 _main test2.obj test2 中引用
其余两个错误也是其他 MAT-API...
enter code here
#include <mat.h>
#include <stdio.h>
void main()
{
MATFile *pmat;
const char **dir;
int ndir;
int i;
mxArray *pfp;
pmat=matOpen("data3.mat","r");
/* get directory of MAT-file */
dir = (const char **)matGetDir(pmat, &ndir);
printf("Directory of %s:\n","data3.mat");
for (i=0; i < ndir; i++)
{
printf("%s\n",dir[i]);
}
//to get the pointer of data from file
pfp=matGetVariable(pmat, "fp");
mxFree(dir);
}
【问题讨论】: