1.vs2010
2.MATLAB 2010b
3.WINDOW 7 (X64)
1.Matlab Environment settings
To build a standalone C application, the system needs to install MATLAB, MATLAB compilers, C/D + + compilers, and MATLAB/C + + Math library functions and graphics library functions.
The MATLAB compiler uses the mbuild command to compile the C + + source code directly into a standalone run program, where MATLAB math library functions can be invoked using the interfaces provided by MATLAB.
Although the generated executable program can run out of the MATLAB environment, it requires support from MATLAB C + + math library files or graphics library files. However, if C + + source code is written in accordance with the traditional C + + source code syntax rules, not including the MATLAB math library and graphics library calls, you can not only independent of the MATLAB environment, and do not need the support of the two library functions.
Enter commands under the command Window in Matlab
mbuild–setup
The operation process is as follows:
then enter the command
Mex–setup
Configure the compiler in a similar way. The configuration of Matlab is complete.
2.VS Environment settings
(1) Set up the Include and library directories
Project Right-click Properties->vc++ directory, include Directories: add
<matlab>\r2010b\extern\include\win64
<matlab>\r2010b\extern\include\
Project Right-property->vc++ directory--Library directory: add
<matlab>\r2010b\extern\lib\win32\microsoft
<matlab>\r2010b\extern\lib\win64\microsoft
(2) Set up the project catalog
Item Right--Properties->c/c++-> general--Accessories include Directories: add
<matlab>\r2010b\extern\include\win64
<matlab>\r2010b\extern\include\
General: Item right, properties---add
<matlab>\r2010b\extern\lib\win32\microsoft
<matlab>\r2010b\extern\lib\win64\microsoft
Attachment dependencies, import-and-Link, properties-right, project-
Libeng.lib
Libmat.lib
Libmex.lib
Libmx.lib
Note: 1.lib files are included in <matlab>\r2010b\extern\lib\win64\microsoft and can be increased or decreased as needed
2. Attachment dependencies are separated by a space before VS2010 and used after VS2010.
Target computer: Change (for 64-bit Windows only), high-level, link, properties, project
MachineX86-MachineX64
Note: The reason for the analysis is that Matlab chooses the X64 compilation environment according to the computer platform, so there will be error 3 if not modified.
(3) Configuration Manager settings (for 64-bit Windows only)
Build, Configuration Manager, platform: change
Win32->x64
Note: The analysis is due to the modification of the target computer in the linker, error 4 occurs when no modification is in place
:
3. System (WINDOWS) environment settings
environment variable->path, advanced system settings, properties--, My Computer, add:
<matlab>\r2010b\bin;<matlab>\r2010b\extern\lib\win64\microsoft;<matlab>\bin\win64
Note: 1. In case of Windows7, "User variables" and "System variables" need to be added, if not added, error 5 will occur at runtime
2. Haha, do not forget to restart the HA, the restart after the effective
ok! This is the end of the configuration, so start Engopen now!! Yes, don't forget to Add # include "Engine.h".
Appendix: Error Conditions and resolution
2. Tip: "Libeng.lib libmat.lib" cannot be opened
Resolution: Attachment dependencies are separated by a space before VS2010 and used after VS2010.
3. Hint: "" Error LNK2019: unresolved external symbol _interp1initialize, the symbol in letter ... ""
Resolution: Operate as 2. VS environment settings (2) Project right--Properties------high-level target computer: Change ... and (3)
4. Tip: "" Module machine Type "X86" conflicts with Target machine type "x64" ... ""
Resolution: Operate as 2. VS environment settings (3)
4. Tip: "System lost libeng.dll ..."
Resolution: Actions such as 3. System Environment settings
No "VS2010" option after 1.mbuild–setup
Resolution: MATLAB 2010B includes support for the VS2010 compiler, and 2010a and previous versions do not contain support. If the MATLAB environment is low, MATLAB official has a patch (http://www.mathworks.com/support/solutions/en/data/1-D5W493/?solution=1-D5W493)
VS2010 and matlab2010b mixed programming