Mex a cpp file in MATLAB, but cannot find .h files, ubuntu 14.04

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!

Answers (2)

You need to find those header files. When you do, simply put them in the current directory where the cpp file is.

1 Comment

Thanks! But where can I find those header files? The problem is, I can find the header files of a same name in different directories. No idea which directory should be the right one in ubuntu 14.04.

Sign in to comment.

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

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Asked:

on 27 Jul 2015

Answered:

on 27 Jul 2015

Community Treasure Hunt

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

Start Hunting!