MATLAB: Do I get syntax errors when I try to link against a MATLAB Compiler generated shared library in MSVC 6.0

dlllibrarylinkMATLAB Compilerpreprocessorsharedsyntax

Why do I get syntax errors when I try to link against a MATLAB Compiler generated shared library in MSVC 6.0?
I get the following error message:
C:\MATLAB6p1\EXTERN\INCLUDE\CPP\mltif.h(10890) : error C2059: syntax error : '('
C:\MATLAB6p1\EXTERN\INCLUDE\CPP\mltif.h(10891) : error C2143: syntax error : missing ';' before '{'
C:\MATLAB6p1\EXTERN\INCLUDE\CPP\mltif.h(10891) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.

Best Answer

These errors are a result of using different Preprocessor definitions than are required by MATLAB Compiler generated shared libaries.
To avoid these errors, make sure you include the following Preprocessor definitions in compiling your application:
MSVC, IBMPC, MSWIND
To edit your Preprocessor definitions, in MSVC, follow the instructions below:
1. Go to Project->Settings->C/C++
2. Under Category, choose Preprocessor.
3. To change the Preprocessor definitions, edit the "Preprocessor definitions" field.