I want to use VS2019+matlab2017b for joint programming, but I can't find the VS19 compiler.
question:
The lower version of matlab2017b cannot find the compiler of the higher version of VS.
Solutions
Increase the configuration file of matlab and add the header file path, so that malab17b supports VS2019
Environment introduction
VS2019:
Guaranteed to have a C++ environment, I only installed desktop development.
In a single component, it is recommended to install the following two.
VS19 is not installed on the C drive, the installation path is
D:\ProgramFiles\VisualStudio\VS2019\IDE\Common7\IDE
Note that this is not the path found by right-clicking on the desktop shortcut.
As shown in the figure, right-click and open the path found in the location
vs. The installation path is the first two directories of the path in the above figure.
As shown below: The installation directory is similar, the following folders
The matlab version is 17B
Solution steps
1. Download the configuration file
msvc2019.xml,msvcpp2019.xml
If it fails, please contact me again
Method: A cloud link: https://pan.baidu.com/s/19qrC-jriYJQjBbKWwtFsww
Extraction code: wbua
2. Add a configuration file
Copy and paste the above two .xml files into the directory under the Matlab installation directory \bin\win64\mexopts
.
After pasting, as shown below
3. Modify the registry
Added configuration files, also need to modify the registry to tell matlab the path to find the vs compiler.
win+R, enter regedit, enter the registry edit
in the following directory
\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7
The new string value
name is 16.0
, the value is: as shown VS的安装路径
in the figure, it is my path.
Note:
1. If there is no SxS\VS7
project path, you can add it manually
2. Do not write the wrong VS installation path (not equal to the path to start the vs file)
4. Installation and verification
Reopen Matlab17 and enter mex -setup -v
Enter.
The following content appears, indicating success
找到已安装的编译器 'Microsoft Visual C++ 2019 (C)'。
MEX 配置为使用 'Microsoft Visual C++ 2019 (C)' 以进行 C 语言编译。
警告: MATLAB C 和 Fortran API 已更改,现可支持
包含 2^32-1 个以上元素的 MATLAB 变量。您需要
更新代码以利用新的 API。
您可以在以下网址找到更多的相关信息:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html。
要选择不同的语言,请从以下选项中选择一种命令:
mex -setup C++
mex -setup FORTRAN
It means that the configuration is successful
. mex -setup C++
Use can successfully install the vs19 compiler.
Other notes:
The installation address of vs entered in the environment variable is guaranteed to be accurate.
Finally, welcome to comment and exchange, if it is helpful, please like it,