MATLAB: Am I unable to compile ENGWINDEMO.C using Borland C++ 5.5 or 5.6 (Free version) with MATLAB 7.5 (R2007b)

5.55.6borlandengineengwindemofreeMATLABr2007bversionwindows

When I compile the Engine Windows demo:
mex -v -f bcc55engmatopts.bat engwindemo.c
I receive the following error:
Error: Unresolved external '_main' referenced from C:\BORLAND\BC.550\CBUILDER5\LIB\C0X32.OBJ
D:\APPLIC~1\MATLAB\R2007A\BIN\MEX.PL: Error: Link of 'engwindemo.exe' failed.

Best Answer

MATLAB applications built with Borland version 5.5 or 5.6 C compilers have changed in MATLAB Version 7.5 (R2007b). MATLAB applications that run under Windows are now implemented as console applications, not Windows applications.
If you have customized the build process based on one of the bcc*engmatopts.bat options files, you must edit this file making changes to the appropriate LINKFLAGS statement, as described in the comments in the options file.
In addition, if you want the compiler to interpret your source form as "free," you must modify the options file by adding /free to the set COMPFLAGS statement. Information about modifying the options file can be found in Custom Building MEX-Files. You can find more information on the /free option in your Borland documentation.
You can find more information in the MATLAB 7.5 (R2007b) External Interfaces Release Notes.