I am trying to compile a Simulink S-function using Mingw.
My Makefile contains the following:
MINGWPATH=D:/Mingw
MATLABROOT=C:\PROGRA~1\MATLAB\R2014b
CC=$(MINGWPATH)/bin/gcc
MEXFLAG=-shared -DMATLAB_MEX_FILE -I$(MATLABROOT)\simulink\include -I$(MATLABROOT)\extern\include -Wl,--export-all-symbols $(LIBS) $(MEXSRC) -o $(MEXTGT).mexw64
LIBS= -L$(MATLABROOT)/bin/win64 -L$(MATLABROOT)/extern/lib/win64/microsoft -lmex -lmx -lmwlapack -lmwblas -leng
MEXTGT=SFCN_Block
MEXSRC=SFCN_Block.cpp
all:$(MEXTGT)
$(MEXTGT): $(MEXSRC)
$(CC) $(MEXFLAG) -ladvapi32 -luser32 -lgdi32 -lkernel32 -lmingwex
The SFCN_Block.cpp
file contains an #include 'simstruc.h'
and simstruc.h
is in C:\PROGRA~1\MATLAB\R2014b\simulink\include
.
But I get the following error:
SFCN_Block.cpp:12:22: fatal error: simstruc.h: No such file or directory
#include "simstruc.h"
^
How can it possibly go wrong?
(My Matlab version is R2014b (64 bits) under Windows 7, and I am trying to compile using Mingw. My Makefile is based on the accepted answer on this question).