Mex a cpp file in MATLAB, but cannot find .h files, ubuntu 14.04
7 views (last 30 days)
Show older comments
Hello, All,
I'm new to mex and trying to rebuild a c++ program with MATLAB interface in my machine. In the cpp file, it has stdafx.h, io.h, direct.h, etc inside. but when I run
mex thefile.cpp
It has
6:20: fatal error: direct.h: No such file or directory
#include <direct.h>
error shown. Here because the file direct.h is the first one, the system just shows this error and terminated. When I tried other .h files as the first one to be included, the system shows the exactly same error except for the header file name.
I don't quite know where those .h files located or even I have it. And I don't know where it should be copied to and how.
Hope someone could help me with that. Thanks!
0 Comments
Answers (2)
James Tursa
on 27 Jul 2015
You need to find those header files. When you do, simply put them in the current directory where the cpp file is.
Walter Roberson
on 27 Jul 2015
Those are Microsoft headers; see http://www.viva64.com/en/b/0265/ and http://stackoverflow.com/questions/6193607/cannot-find-direct-h
As you are using Ubuntu those include files do not apply. You will likely need to edit the code to call POSIX routines instead of Microsoft routines. http://pubs.opengroup.org/onlinepubs/007908775/xsh/dirent.h.html
0 Comments
See Also
Categories
Find more on Introduction to Installation and Licensing 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!