fatal error LNK1104: cannot open file 'libmx.lib libmat.lib libeng.lib'

Hi, I want to make a dll compiled in Matlab, and then use this dll in VS2010. The function is very simple:
function [y] = sinwave(x)
y = sin(x);
end;
and MCC works well, produced .dll, .h, .lib files.
But when I compiled a simple program in VS2010,
#include <stdio.h>
#include <math.h>
//#include "vld.h"
#include <stdlib.h>
#include <string.h>
#include "sinwave.h"
#include "mclmcr.h"
#include "mclmcrrt.h"
#include "mclcppclass.h"
void main(void)
{
if (!mclInitializeApplication(NULL,0))
{
std::cerr << "could not initialize the triangle library properly" << std::endl;
return;
}
if (!sinwaveInitialize())
{
std::cerr << "could not initialize the tb library properly" << std::endl;
return;
}
sinwaveTerminate();
mclTerminateApplication();
}
//an message: LINK : fatal error LNK1104: cannot open file 'libmx.lib libmat.lib libeng.lib' showed.
I added the matlab path extern/lib/win32, win64 to system environment path of my PC, and restart the vs2010.

回答 (2 件)

Kaustubha Govind
Kaustubha Govind 2012 年 6 月 18 日

2 投票

Did you compile using 32-bit MATLAB or 64-bit MATLAB? You need to add extern/lib/win32 if using 32-bit and extern/lib/win64 if using 64-bit (not both). Also, if using 64-bit, make sure that your Visual Studio project is configured to compile for an x64 target (by default it is configured to compile a 32-bit application).

2 件のコメント

Nassah
Nassah 2015 年 5 月 6 日
I got the similar problem.This helps!
aryan srikoti
aryan srikoti 2020 年 10 月 12 日
編集済み: aryan srikoti 2020 年 10 月 12 日
Hello, I have a very similar problem, the configuration of compiler is fine and I can build the program too, when I run it however, box appears with red X mark saying. libmx.lib not found, try reinstalling the software. How to go about this ?
This is in Visual studio 2019 by the way and I'm using win64 configuration, with matlab 2015a

サインインしてコメントする。

Mike Woodward
Mike Woodward 2012 年 6 月 26 日

0 投票

Hi,
It's a full Visual Studio-Simulink integration example that answers the question you've posed. It shows you how to include every file you need.
Mike

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

タグ

質問済み:

2012 年 6 月 17 日

コメント済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by