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

15 views (last 30 days)
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.

Answers (1)

Pratik Pawar
Pratik Pawar on 3 Oct 2022
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.

Community Treasure Hunt

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

Start Hunting!

Translated by