How to compile a MATLAB Engine application in Microsoft Visual Studio
Source: Internet
Author: User
<span id="Label3"></p><p><p>To compile a MATLAB engine application in the Microsoft Visual Studio 9.0 or Microsoft Visual Studio 10.0 EN vironments, perform the steps outlined Below:</p></p><p><p>1. Open Microsoft Visual Studio and select</p></p><p><p>File->new->project</p></p><p><p>and then Select:</p></p><p><p>Empty Project, Visual C + +, General</p></p><p><p>Following this, enter the name of the project and its location in the indicated text areas and click OK.</p></p><p><p>2. Right-click on the SOURCE FILES folder in the solution EXPLORER and click Add, "New Item ...". Choose "c + + file (. cpp)", Enter the name of the file as Enginedemo.cpp. Click OK.</p></p><p><p>3. Copy the code from the source file:engwindemo.c, and paste it to the This file enginedemo.cpp. The file engwindemo.c may obtained from the following location:</p></p><pre><pre>$MATLABROOT/extern/examples/eng_mat</pre></pre><p><p>Where $MATLABROOT is the MATLAB root directory, and could be determined by entering the command:</p></p><pre class="language-matlab"><pre class="language-matlab">Matlabroot</pre></pre><p><p>At the MATLAB command prompt.</p></p><p><p>4. Right click on the project name and select Properties in the Solution Explorer to open the project Properties. Once This window have opened, make the following changes:</p></p><p><p>A. under/c + + general, Add the following directory to the field ADDITIONAL INCLUDE directories:</p></p><p><p><span style="font-family: courier new,courier;">$MATLABROOT \extern\include</span></p></p><p><p>B. under/c + + precompiled Headers, Select "not Using Precompiled Headers".</p></p><p><p>C. Under Linker general, Add the directory to the field ADDITIONAL LIBRARY directories:</p></p><p><p>(for 32-bit Windows)</p></p><p><p><span style="font-family: courier new,courier;">$MATLABROOT \extern\lib\win32\microsoft</span></p></p><p><p>(for 64-bit Windows)</p></p><p><p><span style="font-family: courier new,courier;">$MATLABROOT \extern\lib\win64\microsoft</span></p></p><p><p>D. Under Configuration Properties->debugging</p></p><p><p>ADD the following Target path in the <em>environment</em>:</p></p><p><p>(for + bit MATLAB)</p></p><p><p><span style="font-family: courier new,courier;">Path= $matlabroot \bin\win32</span></p></p><p><p>(for 64-bit MATLAB)</p></p><p><p><span style="font-family: courier new,courier;">Path= $matlabroot \bin\win64</span></p></p><p><p>7. Under Linker Input, Add the following names to the field marked ADDITIONAL DEPENDENCIES:</p></p><p><p><span style="font-family: courier new,courier;">Libmx.lib</span></p></p><p><p><span style="font-family: courier new,courier;">Libmat.lib</span></p></p><p><p><span style="font-family: courier new,courier;">Libeng.lib</span></p></p><p><p>8. If Compiling on 64-bit Windows, change the target to x64 as mentioned on the following link:</p></p><p><p>http://msdn2.microsoft.com/en-us/library/9yb4317s (vs.80). aspx</p></p><p><p>You should now is able to build the Executable.</p></p><p><p>9. Make sure, The following directory is in the PATH:</p></p><p><p>(for 32-bit Windows)</p></p><p><p><span style="font-family: courier new,courier;">$MATLABROOT \bin\win32</span></p></p><p><p>(for 64-bit Windows)</p></p><p><p><span style="font-family: courier new,courier;">$MATLABROOT \bin\win64</span></p></p><p><p>To does this, check the Windows system path by clicking on Start and right click on computer, Properties, Advanc Environment variables, System variables, Settings, Ed system, Open "Path" for Editing.</p></p><p><p>Note:if the machine have more than one MATLAB installed, the directory for the target platform must is ahead of any other Matlab directory (for instance, When compiling a 64-bit application, the directory in the MATLAB 64-bit installation must Is the first one on the PATH).</p></p><p><p>Build and execute the Application.</p></p><p><p>How to compile a MATLAB Engine application in Microsoft Visual Studio</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service