I have been trying to make an s-function block in matlab with my c++ codes.I am using the following mexopts.bat file
@echo off
set MATLAB=%MATLAB%
set PATH=%PATH%;c:\cygwin\bin
set MW_TARGET_ARCH=win64
set COMPILER=x86_64-w64-mingw32-g++
set COMPFLAGS=-c -fexceptions "-I%MATLAB%\extern\include"
set OPTIMFLAGS=-O3
set DEBUGFLAGS=-g -Wall
set NAME_OBJECT=-o
set PRELINK_CMDS1=echo EXPORTS > mex.def & echo mexFunction >> mex.def
set LIBLOC="%MATLAB%\bin\win64"
set LINKER=x86_64-w64-mingw32-g++
set LINKFLAGS= -static-libgcc -shared mex.def -L%LIBLOC% -static-libstdc++
set LINKFLAGSPOST= -lmex -lmx -lmwlapack -lmwblas -lstdc++
set LINKOPTIMFLAGS=-O3
set LINKDEBUGFLAGS= -g -Wall
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=-o "%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=
set POSTLINK_CMDS1=del mex.def
I am able to successfully compile sample mexfunction file from matlab using the 'mex' function,But when i try compiling an s-function(i took the example files with matlab) i get the following errror
C:\Program Files\MATLAB\R2012a\simulink\include/simstruc.h:357:3: error: #error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
C:\Program Files\MATLAB\R2012a\simulink\include/simstruc.h:467:78: fatal error: rt_matrx.h: No such file or directory
compilation terminated.
I am sure the c++ files are correct ,coz i took them from matlab examples