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 2011 年 12 月 7 日

0 投票

Are you attempting to link against libmx.lib libmat.lib libeng.lib in your Linker options? I don't think those are needed. You should only need to link against the .lib file generated for your application by MATLAB Compiler.

4 件のコメント

sam
sam 2011 年 12 月 7 日
I removed the libmx.lib, libmat.lib libeng.lib from <additional dependencies> entry of property manager, but when I compiled the file, I got new error messages:
>testSinwave.obj : error LNK2019: unresolved external symbol _mclTerminateApplication_proxy referenced in function _main
1>testSinwave.obj : error LNK2019: unresolved external symbol _sinwaveTerminate referenced in function _main
1>testSinwave.obj : error LNK2019: unresolved external symbol _sinwaveInitialize referenced in function _main
1>testSinwave.obj : error LNK2019: unresolved external symbol _mclInitializeApplication_proxy referenced in function _main
1>F:\work\LWSProj\VC\sinwave\Debug\sinwave.dll : fatal error LNK1120: 4 unresolved externals
Kaustubha Govind
Kaustubha Govind 2011 年 12 月 8 日
Did you add the .lib (probably called sinwave.lib in your case) generated by MATLAB Compiler instead of "libmx.lib, libmat.lib libeng.lib"? That's where those symbols should be defined.
sam
sam 2011 年 12 月 8 日
Still not work. I tried to add sinwave.h in <additional dependencies> box, and got:
LINK : fatal error LNK1104: cannot open file 'sinwave.lib libmx.lib libmat.lib libeng.lib';
It is weird, since sinwave.lib is in the same folder with soruce file, testSinwave.cpp.
sam
sam 2011 年 12 月 8 日
And I use vs2010 x64, wiin7 x64 version, I had changed property manager: debug/x64, release/x64

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

sam
sam 2011 年 12 月 9 日

0 投票

Finally, it was solved.

2 件のコメント

zohar
zohar 2012 年 9 月 3 日
Hi sam
Tel as how you solve your problem ;-)
Maddila
Maddila 2012 年 10 月 3 日
how u solve this,,please share it

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

カテゴリ

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

タグ

質問済み:

sam
2011 年 12 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by