MATLAB: Do I receive several compiling errors when trying to compile a C++ engine application using the Borland Free Compiler with the MATLAB Compiler

5.5borlandccompileengineerrorfreelinkMATLAB Compilerstdstdlibstdlib.h

Why do I receive several compiling errors when trying to compile a C++ engine application using the Borland Free Compiler with the MATLAB Compiler?
When I create a C++ engine application and use my Borland Free Compiler to compile it, I receive the following errors:
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
GMTIGenerator.cpp:
Error E2132 C:\Borland\bcc55\INCLUDE\stdlib.h 434: Templates and overloaded
operators cannot have C linkage
Error E2040 C:\Borland\bcc55\INCLUDE\stdlib.h 434: Declaration terminated
incorrectly
Error E2316 C:\Borland\bcc55\INCLUDE\stdlib.h 505: '_argc' is not a member
of 'std'
Error E2272 C:\Borland\bcc55\INCLUDE\stdlib.h 505: Identifier expected
Error E2316 C:\Borland\bcc55\INCLUDE\stdlib.h 506: '_argv' is not a member
of 'std'
Error E2272 C:\Borland\bcc55\INCLUDE\stdlib.h 506: Identifier expected
Error E2316 C:\Borland\bcc55\INCLUDE\stdlib.h 603: 'min' is not a member of
'std'
Error E2272 C:\Borland\bcc55\INCLUDE\stdlib.h 603: Identifier expected
Error E2316 C:\Borland\bcc55\INCLUDE\stdlib.h 604: 'max' is not a member of
'std'
Error E2272 C:\Borland\bcc55\INCLUDE\stdlib.h 604: Identifier expected
Error E2190 GMTIGenerator.h 6: Unexpected }
*** 11 errors in Compile ***
F:\MATLAB\BIN\WIN32\MEX.PL: Error: Compile of 'GMTIGenerator.cpp' failed.
??? Error using ==> mex
Unable to complete successfully

Best Answer

The compiling errors are coming from the stdlib.h file. This file is supposed to be a standard ANSI C header file, but in Borlands free compiler this is not the case. Explicitly defining the following symbol alleviates the problem:
#define __STDC__ 1
The _STDC_ symbol is Borland specific and forces standard C.
Note: We have found several similar caveats with the Borland Free Compiler (v5.5). If possible, creating a C engine application will result in fewer compile and link issues.