MATLAB Compiler    

Using an Integrated Development Environment

The MathWorks provides a MATLAB add-in for the Visual Studio development system that lets you work easily within the Microsoft Visual C/C++ (MSVC) integrated development environment (IDE). The MATLAB add-in for Visual Studio greatly simplifies using M-files in the MSVC environment. The add-in automates the integration of M-files into Visual C++ projects. It is fully integrated with the MSVC environment.

The add-in for Visual Studio is automatically installed on your system when you run either mbuild -setup or mex -setup and select Microsoft Visual C/C++ version 5 or 6. However, there are several steps you must follow in order to use the add-in:

  1. To build MEX-files with the add-in for Visual Studio, run the following command at the MATLAB command prompt:
  1. Follow the menus and choose either Microsoft Visual C/C++ 5.0 or 6.0. This configures mex to use the selected Microsoft compiler and also installs the necessary add-in files in your Microsoft Visual C/C++ directories.

  1. To build stand-alone applications with the MATLAB add-in for Visual Studio (requires the MATLAB Compiler and the MATLAB C/C++ Math Libraries), run the following command at the MATLAB command prompt:
  1. Follow the menus and choose either Microsoft Visual C/C++ 5.0 or 6.0. This configures mbuild to use the selected Microsoft compiler and also installs the necessary add-in files into your Microsoft Visual C/C++ directories. (It is not a problem if these overlap with the files installed by the mex -setup command.)

  1. For either mex or stand-alone support, you should also run the following commands at the MATLAB prompt:
  1. These commands save your current MATLAB path to a file named mccpath in your user preferences directory. (Type prefdir to see the name of your user preferences directory.)

    This step is necessary because the MATLAB add-in for Visual Studio runs outside of the MATLAB environment, so it would have no way to determine your MATLAB path. If you add directories to your MATLAB path and want them to be visible to the MATLAB add-in, rerun the cd and mccsavepath commands shown in this step and replace prefdir with the desired pathname.

  1. To configure the MATLAB add-in for Visual Studio to work with Microsoft Visual C/C++:
    1. Select Tools -> Customize from the MSVC menu.
    2. Click on the Add-ins and Macro Files tab.
    3. Select MATLAB for Visual Studio on the Add-ins and Macro Files list and click Close. The floating MATLAB add-in for Visual Studio toolbar appears. Selecting MATLAB for Visual Studio directs MSVC to automatically load the add-in when you start MSVC again.

Configuring on Windows 98 and Windows Me Systems

Windows 98.   To run the MATLAB add-in for Visual Studio on Windows 98 systems, add this line to your config.sys file:

Windows Me.   To run the MATLAB add-in for Visual Studio on Windows Me systems, do the following:

  1. Find C:\windows\system\conagent.exe in the Windows Explorer.
  2. Right-click on the conagent.exe icon.
  3. Select Properties from the context menu. This brings up the CONAGENT.EXE Properties window.
  4. Select the Memory tab in the CONAGENT.EXE Properties window.
  5. Set the Initial Environment field to 4096.
  6. Click Apply.
  7. Click OK.

For additional information on the MATLAB add-in for Visual Studio:


  Verifying the MATLAB Compiler Packaging Windows Applications for Distribution