Dynamic and Shared Libraries

Hello everyone,
I have a .dll file that i have downloaded from the internet. This file has been reported as a dependancy by the walker software. I am trying to include it in my MEX command. However i get an error while compiling. I have saved the .dll file to the same folder from where i run the make file which contains the mex command.
How do i sort it out?
mex msvcr7.lib
LINK : fatal error LNK1181: cannot open input file 'msvcr7.lib'

6 件のコメント

Geoff Hayes
Geoff Hayes 2019 年 4 月 10 日
VInayak - please clarify if you have a dll or a static library. Your code suggests that you have a lib but you indicate that you have a dll. Which is it?
VINAYAK KARANDIKAR
VINAYAK KARANDIKAR 2019 年 4 月 10 日
I have a dll. But for the sake of compilation using mex command, i have used the .lib extension.
By the way, using the .dll extension gives the error:
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: mex cannot link to 'msvcr7.dll' directly.
Instead, you must link to the file 'msvcr7.lib' which corresponds to 'msvcr7.dll'.
Geoff Hayes
Geoff Hayes 2019 年 4 月 10 日
From mex filenames input param, For linking dynamic libraries, use the -llibname option. Have you tried to do this?
VINAYAK KARANDIKAR
VINAYAK KARANDIKAR 2019 年 4 月 10 日
@Geoff Hayes
Hey that gave me the result:
Warning: MEX could not find the library "msvcr7.dll" specified with -l option.
MEX looked for a file with one of the names:
msvcr7.dll.lib
libmsvcr7.dll.lib
MEX looked for the library in the following directories:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\v7.1\LIB\X64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\AMD64
C:\Program Files\MATLAB\R2013b\extern\lib\win64
C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
.C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
Now which location do i place the said .dll file, among those reported above in the code?
Just another thing: The walker program shows 9 dll dependencies and other dependencies (100 odd or possibly more!!) are of the type "API-MS-WIN-CORE-WOW64-L1-1-1.DLL"
Do i ignore those..cause i can't possibly sit and replace ALL of them?
Thanks a lot,
Vinayak
Walter Roberson
Walter Roberson 2019 年 4 月 10 日
-lmsvcr7
Ignore the API-MS entries.
VINAYAK KARANDIKAR
VINAYAK KARANDIKAR 2019 年 4 月 10 日
@Walter Roberson
I tried this:
function make()
mex -largeArrayDims -v -g -I. ../MATLAB_USRP_INTERFACE/uhdinterface.cpp ../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB_USRP_INTERFACE/mexutil.cpp ../MATLAB_USRP_INTERFACE/uhd_functions.cpp ../MATLAB_USRP_INTERFACE/storage.cpp -L."C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" libboost_thread-vc100-mt-1_55.lib libboost_date_time-vc100-mt-1_55.lib libboost_system-vc100-mt-1_55.lib libboost_chrono-vc100-mt-1_55.lib uhd.lib libmx.lib libmex.lib libmat.lib ...
-lmsvcr7
% mex -g uhd.lib -I. ../MATLAB_USRP_INTERFACE/uhdinterface.cpp ../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB_USRP_INTERFACE/mexutil.cpp ../MATLAB_USRP_INTERFACE/uhd_functions.cpp ../MATLAB_USRP_INTERFACE/storage.cpp
end
and i get this:
Warning: MEX could not find the library "msvcr7" specified with -l option.
MEX looked for a file with one of the names:
msvcr7.lib
libmsvcr7.lib
MEX looked for the library in the following directories:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\v7.1\LIB\X64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\AMD64
C:\Program Files\MATLAB\R2013b\extern\lib\win64
C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
.C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
further, i tried this:
function make()
mex -largeArrayDims -v -g -I. ../MATLAB_USRP_INTERFACE/uhdinterface.cpp ../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB_USRP_INTERFACE/mexutil.cpp ../MATLAB_USRP_INTERFACE/uhd_functions.cpp ../MATLAB_USRP_INTERFACE/storage.cpp -L."C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" libboost_thread-vc100-mt-1_55.lib libboost_date_time-vc100-mt-1_55.lib libboost_system-vc100-mt-1_55.lib libboost_chrono-vc100-mt-1_55.lib uhd.lib libmx.lib libmex.lib libmat.lib ...
-lmsvcr7.dll
% mex -g uhd.lib -I. ../MATLAB_USRP_INTERFACE/uhdinterface.cpp ../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB_USRP_INTERFACE/mexutil.cpp ../MATLAB_USRP_INTERFACE/uhd_functions.cpp ../MATLAB_USRP_INTERFACE/storage.cpp
end
and i get this:
Warning: MEX could not find the library "msvcr7.dll" specified with -l option.
MEX looked for a file with one of the names:
msvcr7.dll.lib
libmsvcr7.dll.lib
MEX looked for the library in the following directories:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\v7.1\LIB\X64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\AMD64
C:\Program Files\MATLAB\R2013b\extern\lib\win64
C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
.C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
Then finally i tried this:
function make()
mex -largeArrayDims -v -g -I. ../MATLAB_USRP_INTERFACE/uhdinterface.cpp ../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB_USRP_INTERFACE/mexutil.cpp ../MATLAB_USRP_INTERFACE/uhd_functions.cpp ../MATLAB_USRP_INTERFACE/storage.cpp -L."C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" libboost_thread-vc100-mt-1_55.lib libboost_date_time-vc100-mt-1_55.lib libboost_system-vc100-mt-1_55.lib libboost_chrono-vc100-mt-1_55.lib uhd.lib libmx.lib libmex.lib libmat.lib ...
-lmsvcr7.lib
% mex -g uhd.lib -I. ../MATLAB_USRP_INTERFACE/uhdinterface.cpp ../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB_USRP_INTERFACE/mexutil.cpp ../MATLAB_USRP_INTERFACE/uhd_functions.cpp ../MATLAB_USRP_INTERFACE/storage.cpp
end
and i get this:
Warning: MEX could not find the library "msvcr7.lib" specified with -l option.
MEX looked for a file with one of the names:
msvcr7.lib.lib
libmsvcr7.lib.lib
MEX looked for the library in the following directories:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\v7.1\LIB\X64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\AMD64
C:\Program Files\MATLAB\R2013b\extern\lib\win64
C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
.C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
What do i do?

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

回答 (0 件)

カテゴリ

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

製品

リリース

R2013b

質問済み:

2019 年 4 月 10 日

コメント済み:

2019 年 4 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by