How to read the .mat file in visual studio 2019 (C)?

26 次查看(过去 30 天)
I want to read the .mat file in visual studio.
That is my code and error.
How can I solve this problem?
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <mat.h>
#include <matrix.h>
//#pragma comment(lib, "libmx.lib")
//#pragma comment(lib, "libmat.lib")
int main()
{
MATFile* pmat;
const char* file = "ais_data20220716.mat";
pmat = matOpen(file, "r");
int ship_number = 31;
return 0;
}
%-----------------------------------------error------------------------------
[in Korean]
error LNK2019: _matOpen_800_main 함수에서 참조되는 확인할 수 없는 외부 기호
fatal error LNK1120: 1개의 확인할 수 없는 외부 참조입니다.
[in English]
error LNK2019: unresolved external symbol referenced in function _matOpen_800_main
error LNK1120: 1 unresolved externals.

回答(1 个)

Pratik Pawar
Pratik Pawar 2022-10-3
To compile a C/C++ in the Microsoft Visual Studio 19 environments, please perform the steps described in the following link:
I hope the steps mentioned in the above link will resolve the link error.

类别

Help CenterFile Exchange 中查找有关 Build MATLAB Interface to C++ Library 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by