From: Carole BAROME on
Hi,
I'm trying to compile a C++ file using the mex compiling function :
mex -f mexopts1.bat CPP_Example.cpp SPA_SDK.h
where mexopts1.bat is the following one.
The error is :
CPP_Example.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\comdef.h(29) : fatal error C1083: Cannot open include file: 'ole2.h': No such file or directory

C:\MATLAB701\BIN\WIN32\MEX.PL: Error: Compile of 'CPP_Example.cpp' failed.

I think I have to add the win 32 lib, such as ole32.lib, but I don't know how to do.
Thanks in advance.
Here is my mexopts1.bat file :


@echo off
rem MSVC60OPTS.BAT
rem
rem Compile and link options used for building MEX-files
rem using the Microsoft Visual C++ compiler version 6.0
rem
rem $Revision: 1.11.4.1 $ $Date: 2003/01/30 21:27:30 $
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************

set MATLAB=%MATLAB%
set MSVCDir=C:\Program Files\Microsoft Visual Studio 9.0\VC
set DevEnvDir=%MSVCDir%\..\Common7\Tools
set PATH=%MSVCDir%\BIN;%DevEnvDir%;%MSVCDir%\..\Common7\IDE;%MATLAB_BIN%;%PATH%;
set INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\DIA SDK\include;%INCLUDE%
set LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\DIA SDK\lib;%MATLAB%\extern\lib\win32;%LIB%

rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=cl
set COMPFLAGS=-c -Zp8 -W3 -DMATLAB_MEX_FILE -nologo
set OPTIMFLAGS=/MD -O2 -Oy- -DNDEBUG
set DEBUGFLAGS=/MDd -Zi -Fd"%OUTDIR%%MEX_NAME%.pdb"
set NAME_OBJECT=/Fo

rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\microsoft\msvc71
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /MAP /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /implib:%LIB_NAME%.x
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%.dll"
set RSP_FILE_INDICATOR=@

rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=

set POSTLINK_CMDS=del "%OUTDIR%%MEX_NAME%.map"
set POSTLINK_CMDS1=del %LIB_NAME%.x
From: James Tursa on
"Carole BAROME" <carolebarome(a)yahoo.fr> wrote in message <hocna8$i54$1(a)fred.mathworks.com>...
> Hi,
> I'm trying to compile a C++ file using the mex compiling function :
> mex -f mexopts1.bat CPP_Example.cpp SPA_SDK.h

This does not look right to me. Header files are not typically included on the mex command line, so your SPA_SDK.h file looks misplaced here. Typically header files have an #include line for them in the source code itself, presumably your CPP_Example.cpp file. Only source code and object files or libraries go on the mex command line.

James Tursa