0

I'm trying to compile a Matlab mex project on Mac OS X 10.12.1. I run the following command:

mex HybridEMMex.cpp Hybrid.cpp Util.cpp COMPFLAGS="/openmp $COMPFLAGS" CXXFLAGS="\$CXXFLAGS -std=c++0x" LDFLAGS="\$LDFLAGS -fopenmp" It throws an error:

Building with 'Xcode Clang++'.
Error using mex
/Users/tiendh/Projects/FisherVector/hglmm_fv_v1.6/fv/HGLMM_linux/Hybrid.cpp:6:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^
1 error generated.

I've installed gcc because I suspect the compiler clang is the cause of this problem. However, I don't know how to make Matlab use the correct compiler. Please also beaware that I don't know if the error comes from clang. How can I compile the project? Many thanks.

lenhhoxung
  • 2,530
  • 2
  • 30
  • 61
  • Related? http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x – Suever Dec 27 '16 at 16:49
  • 1
    I've checked that question, but no solutions can be applied for me. – lenhhoxung Dec 27 '16 at 17:06
  • Why not? DId you look at [how to change your compiler](https://www.mathworks.com/help/matlab/matlab_external/changing-default-compiler.html)? – Suever Dec 27 '16 at 17:07
  • Yes, I did. Here is the command I used: `mex -v GCC='/usr/local/Cellar/gcc/6.3.0/bin/gcc-6' HybridEMMex.cpp Hybrid.cpp Util.cpp COMPFLAGS="/openmp $COMPFLAGS" CXXFLAGS="\$CXXFLAGS -std=c++0x" LDFLAGS="\$LDFLAGS -fopenmp"`, and still doesn't work. – lenhhoxung Dec 27 '16 at 17:14
  • Oh, I noticed that Matlab cannot change the default compiler. It always says: "Building with 'Xcode with Clang'" – lenhhoxung Dec 27 '16 at 17:18

0 Answers0