Mex file compilation given include files and library files

Hello everyone,
The following is what i want to run:
function make()
mex -g -I C:\Program Files\UHD\include\uhd\multi_usrp.hpp ../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\UHD\lib\uhd.lib;
% mex -g -I ../MATLAB_USRP_INTERFACE/uhdinterface.cpp C:\Program Files\UHD\include\uhd\usrp\multi_usrp.hpp C:\Program Files\UHD
% mex -g -I ../MATLAB_USRP_INTERFACE/multi_usrp.hpp ../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 ../MATLAB_USRP_INTERFACE/uhd.lib;
% mex -g -L ../MATLAB_USRP_INTERFACE/uhd.lib -I ../MATLAB_USRP_INTERFACE/multi_usrp.hpp ;
% mex -g -L C:\ProgramFiles\UHD\lib\uhd.lib ;
end
However i get the following error:
make
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: 'C:\Program' not found.
Unable to complete successfully.
Error in make (line 17)
mex -g -I C:\Program Files\UHD\include\uhd\multi_usrp.hpp ../MATLAB_USRP_INTERFACE/uhdinterface.cpp
../MATLAB_USRP_INTERFACE/tx_functions.cpp ../MATLAB_USRP_INTERFACE/rx_functions.cpp ../MATLAB
Now what can be wrong?
Thanks a lot

4 Comments

Hello Vinayak,
I am facing a similar issue.
function make()
mex -v -g -L"C:\local\UHD\lib\uhd.lib" ../mex/uhdinterface.cpp ../mex/tx_functions.cpp ../mex/rx_functions.cpp ../mex/mexutil.cpp ../mex/uhd_functions.cpp ../mex/storage.cpp;
end
error:
Error using mex
uhdinterface.cpp
e:\uhdinterface-master\mex\uhdinterface.hpp(21): fatal error C1083: Cannot open include file: 'uhd/usrp/multi_usrp.hpp':
No such file or directory
is there any other way to include the uhd.lib file ?
Aliza,
what you have to do is this: copy the folder "C:\Program Files\UHD\include\uhd" to your working MATLAB directory. Then go to the uhd folder, find the missing include file, here it is the multi_usrp.hpp, and put a copy of it in the outside folder, in the main working space.
Also check my command:
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 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 ...
-L."C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft"
%
Hope this helps.
Regards,
Vinayak
Thanks alot Vinayak,
it worked!!!!!!
Hi Vinayak
I have seen lot of your questions realted to uhdinterface. Were you able to use it.
Thanks
Ashish

Sign in to comment.

 Accepted Answer

Jan
Jan on 27 Mar 2019
Edited: Jan on 27 Mar 2019
Replace
mex -g -I C:\Program Files\UHD\include\uhd\multi_usrp.hpp ...
by
mex -g -I "C:\Program Files\UHD\include\uhd\multi_usrp.hpp" ...
You need this, whenever a space occurs in the path or file name.

6 Comments

Thanks,
but i still get the error:
make
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: 'C:\Program Files\UHD\include\uhd\multi_usrp.hpp' not found.
Unable to complete successfully.
And i checked, the path(s) is(are) correct
There is an update on this situation:
Now i get:
make
uhdinterface.cpp
c:\users\vinayak karandikar\documents\matlab\matlab\thesis\matlab_usrp_interface\uhdinterface.hpp(18) : fatal error C1083: Cannot open include file: 'uhd/usrp/multi_usrp.hpp': No such file or directory
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Compile of '..\MATLAB_USRP_INTERFACE\uhdinterface.cpp' failed.
The error message is clear. At first you have searched for
C:\Program Files\UHD\include\uhd\multi_usrp.hpp
Now it is
uhd/usrp/multi_usrp.hpp
I do not have any chance to guess, why the code epxects this file in this folder. You did not mention, where this code is comming from or what it should do. Please ask the author for help.
I have made those small corrections(it was a small mistake). However the same error still persists:
uhdinterface.cpp
c:\users\vinayak karandikar\documents\matlab\matlab\thesis\matlab_usrp_interface\uhdinterface.hpp(18) : fatal error C1083: Cannot open include file: 'uhd/usrp/multi_usrp.hpp': No such file or directory
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Compile of '..\MATLAB_USRP_INTERFACE\uhdinterface.cpp' failed.
Unable to complete successfully.
Your code tries to include uhd/usrp/multi_usrp.hpp, but this file is not found. Do you include this by:
include <uhd/usrp/multi_usrp.hpp>
% or
include "uhd/usrp/multi_usrp.hpp"
? Is the parent folder of /uhd/usrp/ included in the provided library paths?
No, actually i had to just include a library called uhd.lib in the mex command. There was a problem doing that. Now everything is sorted out. I have the MEX file now, FINALLY!!!

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!