Using mex: Cannot open include file: 'levmar.h': No such file or directory

6 views (last 30 days)
I am still learning how to use the mex command and I have a file called levmar.c which has #include levmar.h
I type in the command prompt
mex levmar.c
and the following text appears
Building with 'Microsoft Visual C++ 2012 (C)'.
Error using mex
levmar.c
C:\Users\Alex\Documents\levmar-2.6\levmar-2.6\matlab\levmar.c(27)
: fatal error C1083: Cannot open include file:
'levmar.h': No such file or directory
I have levmar.h in the working directory, so I don't know why I would be getting this error unless all include files have to be in a special directory. Using the option to specify the pathname for include files I typed the following into the command prompt:
>> mex levmar.c -I<C:\Users\Alex\Documents\levmar-2.6\levmar-2.6\matlab>
And the following was the result:
Building with 'Microsoft Visual C++ 2012 (C)'.
Error using mex
Access is denied.
Does anyone know why this could be happening? Thank you in advance!

Answers (1)

James Tursa
James Tursa on 29 Jun 2015
Edited: James Tursa on 29 Jun 2015
levmar.h needs to be in the current directory. Try copying it there.

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) 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!