Error using mex (g++ error: No such file or directory) - matlab

I'm trying to compile a library in Matlab (http://spams-devel.gforge.inria.fr/downloads.html) on Windows, using the given compile script, but am getting the following error.
Error using mex
g++: error: /c: No such file or directory
g++: error:
/FoC:\Users\Owner\AppData\Local\Temp\mex_4354548680745_632\mexArchetypalAnalysis.obj:
No such file or directory
Error in compile (line 456)
mex(args{:});
I'm stuck here. What's going wrong and how do I fix it?

I was facing the same problem in Windows.
Try changing CFLAGS to COMPFLAGS. It worked for me.
Source: https://github.com/cjlin1/libsvm/issues/55

Related

Error while using mex file in Colab with Octave

I am trying to use MATLAB in Colab. MATLAB is run in Colab through Octave. I have to use the MR8fast() filter, which in turn uses anigauss.c. I could successfully compile anigauss.c using
mkoctfile --mex -DMATLAB_MEX_FILE anigauss.c. anigauss.mex and anigauss.o files are created in the content folder in Colab. But while running the code which uses this function, its throwing an error
error: Invalid use of Script /content/anigauss.m in index expression
error: called from
MR8fast at line 20 column 13
How can I fix this error? Any help in this regard is greatly appreciated.

Can not build a mex file in octave using mkoctfile --mex

I am trying to build a mex file in octave. The Octave instructions says that we need to use mkoctfile --mex to build one. The file I am trying to build is in the following path:
> C:\devwork\Octave\boosted\toolbox\channels\private\rgbConvert.cpp
When I write
> mkoctfile --mex rgbConvert.cpp
I get the following error:
> g++: error: rgbConvert.cpp: No such file or directory g++: fatal
> error: no input files compilation terminated.
Note: My current directory is set correct. It is at \devwork\Octave\boosted\toolbox\channels\private
Can some one explain me why am I getting this error.
The problem is resolved using: mkoctfile --mex -DMATLAB_MEX_FILE rgbConvertMex.cpp
Hence, if you want to convert any Matlab compiled .mex file to Octave executable file, do the following two steps:
Modify wrappers.hpp file by adding #include <stdlib.h>
Save the file.
Simply run: mkoctfile --mex -DMATLAB_MEX_FILE file_name
.o file will be created.
I did it using the same and it worked fine.
Eskapp was grateful enough to release the Octave compiled MEX files. You'll need to manually add the files to the main toolbox.Please find the link here:
https://github.com/Eskapp/Piotr_vision_extrafiles_Octave
Hope it helps others :)

MATLAB include error : fatal error C1083: Cannot open include file: 'cblas.h'

I am using a optimization toolbox for solving sparse estimation problems. I have downloaded the software from SPAMS homepage and would like to create a mex-file from mexLasso.m for my application.
I transfer all the error-invoking include files to MATLAB external/include folder. In MATLAB, once I type in:
>> mex mexLasso.cpp
I receive this error:
C:\Program Files\MATLAB\R2012b\extern\include\utils.h(28)
fatal error C1083: Cannot open include file: 'cblas.h'
How can I solve this problem?
Thanks
For mex-ing: Have you setup your compiler?
>> mex -setup
Choose visual studio compiler over Matlab's lcc.
Do you have a header file cblas.h? where is it located?
Use the following flags to compile
>> mex -O -largeArrayDims -v mexLasso.cpp
The -v flag should give you a verbose output - see what are the include directories the compiler search in for header file. You can add folders to the search path with the flag -I <folder name>

Invalid MEX-file error in MATLAB using GPUstart

I get following error with run GPUstart in Matlab:
Error using ==> moduleinit at 14
Invalid MEX-file 'C:\GPUmat\modules\rand\RANDModuleManager.mexw64': The
specified module could not be found.
Error in ==> GPUmatLoadModules at 18
moduleinit;
Error in ==> GPUstart at 168
GPUmatLoadModules(fullfile(GPUmatPath,'modules'));
How to solve this?
I found a similar problem in google, maybe it will help you:
http://www.mathworks.de/support/solutions/en/data/1-X8A09/index.html
Subject:
Why do I receive a "specified module could not be found" error while
running a MEX-file created from MATLAB 7.0.1 (R14SP1)? Problem
Description:
When I try to run a MEX-file I created, I receive the following error:
??? Invalid MEX-file 'MEX-file name': The specified module could not
be found. where "MEX-file name" is the name of my MEX-file. However, I
did not receive any errors when compiling the file.
Solution:
This error can occur if you do not have all of the necessary DLL files
that the MEX-function is dependent upon or if you are running a
MEX-file on a different version of MATLAB than it was compiled on.
In order to view dependent DLL files and help locate the source of
this error, you may use the third-party product "Dependency Walker".
The Dependency Walker can be downloaded from the following web site:
http://www.dependencywalker.com/
Kindly refer to the attached solutioon below for more information on
how to use the Dependency Walker to profile your MEX file.
After finding the missing dependent module, add it to the directory
where the MEX file resides or add it to the system search path.

matlab to c++: Cannot open include file: 'mclmcrrt.h': No such file or directory

We tried to complie the m file to c++ file by matlab complier. We had the file bulit but we got the error msg as follow.
fatal error C1083: Cannot open include file: 'mclmcrrt.h': No such file or directory
Do you have any ideas about the error msg? Any suggestion will be appreciated. Thanks a lot.
Ying
This error message is caused because you need MCR dlls.
You should locate the h file in "C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v715\extern\include\"
and add it to your include path in C.
Check out the manual of Matlab compiler.