Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler

这篇具有很好参考价值的文章主要介绍了Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1、确定一下您的问题:错误使用Mex
Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler
2、再执行以下命令:
Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler
如果您的结果跟我一样,那么可以继续看,如果不一样,就可能不是同一个问题。
下面直接说解决方案:
3、打开powershell,执行下面命令
install-module -scope currentuser MSI

install-module -scope currentuser MSI

按照提示输入Y

4、继续执行命令
get-msirelatedproductinfo ‘{1571205C-BAD1-4237-BFE6-B77E622C51DB}’

get-msirelatedproductinfo '{1571205C-BAD1-4237-BFE6-B77E622C51DB}'

很有可能该命令会出错
Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler该错误是因为禁用了脚本执行的权限,需要再执行允许执行脚本权限即可

5、出现上面错误时执行命令,否则跳过
set-ExecutionPolicy RemoteSigned

set-ExecutionPolicy RemoteSigned

这时,再执行上面的命令就可以正常执行了。

6、继续执行命令
get-msirelatedproductinfo ‘{1571205C-BAD1-4237-BFE6-B77E622C51DB}’ | repair-msiproduct

get-msirelatedproductinfo '{1571205C-BAD1-4237-BFE6-B77E622C51DB}' | repair-msiproduct

执行该命令很有可能还会出错
Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler
该错误是因为set configuration出错,
解决方案:下载一个最新的Microsoft.VisualStudio.Setup.Configuration.msi安装就可以了。
或者从vs2019安装文件中搜索“Microsoft.VisualStudio.Setup.Configuration.msi”,并安装就好了。
安装完后,再执行一次出错的命令就会正常了。

7、至此,问题已经解决,测试命令
vswhere.exe
如果输出仍然是第2步的结果,则说明未解决,如果输出如下,则ok
Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler
因为该问题,我已经测试了很多种方法,网上基本上就是修改注册表,清理注册表,重装matlab,重装vs都试过了,全都无效,就差重装系统了。也不是安装先后的问题,差点就要放弃了。也测试了TotalUninstaller.zip工具卸载,无效。该问题困扰多天,希望能够帮助后来人不要受到该问题困扰。

====================================================================
下面是第二种解决方案,可以参考
其实修改注册表的办法不是没有效,只是需要根据xml文件内容来更改,如果您的xml文件与我的一样,那么可以尝试通过注册表解决

msvc2019.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config
    Name="Microsoft Visual C++ 2019 (C)"
    ShortName="MSVC160"
    Manufacturer="Microsoft"
    Version="16.0"
    Language="C"
    Priority="A"
    Location="$VCROOT\" >
    <Details
        CompilerExecutable="$COMPILER"
        CompilerDefines="$COMPDEFINES"
        CompilerFlags="$COMPFLAGS"
        OptimizationFlags="$OPTIMFLAGS"
        DebugFlags="$DEBUGFLAGS"
        IncludeFlags="$INCLUDE"
        LinkerExecutable="$LINKER"
        LinkerFlags="$LINKFLAGS"
        LinkerLibraries="$LINKLIBS"
        LinkerDebugFlags="$LINKDEBUGFLAGS"
        LinkerOptimizationFlags="$LINKOPTIMFLAGS"
        CommandLineShell="$VCVARSALLDIR\VCVARSALL.BAT "
        CommandLineShellArg="amd64"
        CompilerDefineFormatter="/D%s"
        LinkerLibrarySwitchFormatter="lib%s.lib;%s.lib"
        LinkerPathFormatter="/LIBPATH:%s"
        LibrarySearchPath="$$LIB;$$LIBPATH;$$PATH;$$INCLUDE;$MATLABROOT\extern\lib\$ARCH\microsoft"
    />
    <!-- Switch guide: http://msdn.microsoft.com/en-us/library/fwkeyyhe(v=vs.71).aspx -->
    <vars
        CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
        CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORTVER $OBJS $LINKLIBS /out:$EXE"
        CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
        CMDLINE300="del $EXP $LIB $MANIFEST $ILK"

        COMPILER="cl"
        COMPFLAGS="/Zp8 /GR /W3 /EHs /nologo /MD"
        COMPDEFINES="/D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0  $MATLABMEX"
        MATLABMEX=" /DMATLAB_MEX_FILE"
        OPTIMFLAGS="/O2 /Oy- /DNDEBUG"
        INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\simulink\include&quot;"
        DEBUGFLAGS="/Z7"

        LINKER="link"
        LINKFLAGS="/nologo /manifest "
        LINKTYPE="/DLL"
        LINKEXPORT="/EXPORT:mexFunction"
        LINKEXPORTVER="/EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion"
        LINKLIBS="/LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
        LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME$LDEXT.pdb&quot;"
        LINKOPTIMFLAGS=""

        OBJEXT=".obj"
        LDEXT=".mexw64"
        SETENV="set COMPILER=$COMPILER
                set COMPFLAGS=/c $COMPFLAGS $COMPDEFINES $MATLABMEX
                set OPTIMFLAGS=$OPTIMFLAGS
                set DEBUGFLAGS=$DEBUGFLAGS
                set LINKER=$LINKER
                set LINKFLAGS=$LINKFLAGS /export:%ENTRYPOINT% $LINKTYPE $LINKLIBS $LINKEXPORT
                set LINKDEBUGFLAGS=/debug /PDB:&quot;%OUTDIR%%MEX_NAME%$LDEXT.pdb&quot;
                set NAME_OUTPUT=/out:&quot;%OUTDIR%%MEX_NAME%%MEX_EXT%&quot;"

    />
    <client>
        <engine
            LINKLIBS="$LINKLIBS libeng.lib"
            LINKEXPORT=""
            LINKEXPORTVER=""
            LDEXT=".exe"
            LINKTYPE=""
            MATLABMEX=""
        />
        <mbuild
            CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
            CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $OBJS $LINKLIBS /out:$EXE"
            CMDLINE250="$MTCMDLINE"
            CMDLINE300="del $MANIFEST &quot;$TEMPNAME.map&quot; "
            LINKFLAGS="/nologo /manifest"
            LINKLIBS="/MACHINE:AMD64 /LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; mclmcrrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
            INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
            COMPFLAGS="-MD -Zp8 -GR -W3 -EHsc- -Zc:wchar_t- -nologo"
            COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE"
            OPTIMFLAGS="-O2 -DNDEBUG"
            LINKEXPORT=""
            LINKEXPORTVER=""
            LDEXT=".exe"
            MATLABMEX=""
            MTCMDLINE="mt -outputresource:$EXE;1 -manifest $MANIFEST"
            LINKTYPE=""
            LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME.pdb&quot;"
        />

        <mbuild_com
            CMDLINE000="copy &quot;$MATLABROOT\extern\include\$ARCH\mwcomutil.tlb&quot; ."
            CMDLINE001="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; mwcomtypes.idl"
            CMDLINE002="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; &quot;$COMIDL&quot;"
            CMDLINE100="$COMPILER $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $COMPINCLUDE $SRC /Fo$OBJ"
            CMDLINE150="rc /fo &quot;$RESFILE&quot; &quot;$RCFILE&quot;"
            CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
            CMDLINE275="&quot;$MATLABROOT\runtime\$ARCH\mwregsvr.exe&quot; $EXE"
            CMDLINE300="del $MANIFEST mwcomutil.tlb &quot;$RESFILE&quot;"

            OUTDIR="."
            INCLUDE="$INCLUDE -I&quot;$OUTDIR&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
            COMPFLAGS="/c /GR /W3 /EHsc- -Zc:wchar_t /nologo /MT"
            COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE"
            COMPINCLUDE="-I&quot;$MATLABROOT\extern\include&quot;"

            LINKEXPORT="/DLL /def:&quot;$DEFFILE&quot;"
            LINKEXPORTVER="/DLL /def:&quot;$DEFFILE&quot;"
            LINKLIBS="/MACHINE:AMD64 $LINKLIBS mclmcrrt.lib $MCLMAINLIB_MS &quot;$RESFILE&quot;"
            LDEXT=".dll"
            USERONLY=""
            LINKTYPE=""
            MATLABMEX=""
          />
    </client>
    <locationFinder>
        <VCROOT>
            <and>
                <or>
                    <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                </or>
                <cmdReturns name="set &quot;vcroot=$$&quot;&amp;for /f &quot;delims= &quot; %a in ('type &quot;$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt&quot;') do @if exist &quot;$$\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe&quot; call echo %vcroot%" />
            </and>
        </VCROOT>
        <SDKROOT>
            <or>
                <hklmExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
                <hkcuExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
                <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
                <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
            </or>
        </SDKROOT>
        <VSINSTALLDIR>
            <or>
                <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
            </or>
        </VSINSTALLDIR>
        <VCINSTALLDIR>
            <and>
                <or>
                    <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                </or>
                <cmdReturns name="set &quot;vcroot=$$&quot;&amp;for /f &quot;delims= &quot; %a in ('type &quot;$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt&quot;') do @if exist &quot;$$\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe&quot; call echo %vcroot%\VC\Tools\MSVC\%a" />
            </and>
        </VCINSTALLDIR>
        <VCVARSALLDIR>
            <and>
                <or>
                    <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                </or>
                <fileExists name="$$\VC\Auxiliary\Build\vcvarsall.bat" />
                <dirExists name="$$"/>
            </and>
        </VCVARSALLDIR>
        <KITSROOT>
            <or>
                <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                <hklmExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                <hkcuExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                
            </or>
        </KITSROOT>
        <SDKVERSION>
            <and>
                <or>
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    <hklmExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    <hkcuExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    
                </or>
                <!-- For each folder inside '<KITSROOT>\include' check for 'ucrt' and if exists return that folder name -->
                <cmdReturns name="echo off&amp;set &quot;sdkversion=&quot;&amp;(for /f %a IN ('dir &quot;$$\include\&quot; /b /ad-h /on') do ( @if exist &quot;$$\include\%a\ucrt\&quot; set &quot;sdkversion=%a&quot; ))&amp;call echo %sdkversion%" />
            </and>
        </SDKVERSION>
    </locationFinder>
    <env
        PATH="$VCINSTALLDIR\bin\HostX64\x64\;$VCROOT\Common7\IDE\VC\vcpackages;$VCROOT\Common7\IDE;$VCROOT\Common7\Tools;$SDKROOT\Bin\$SDKVERSION\x64;$SDKROOT\Bin\$SDKVERSION\x86;$SDKROOT\Bin\x64;$SDKROOT\Bin\x86;"
        INCLUDE="$VCINSTALLDIR\include;$VCINSTALLDIR\atlmfc\include;$KITSROOT\include\$SDKVERSION\ucrt;$KITSROOT\include\$SDKVERSION\shared;$KITSROOT\include\$SDKVERSION\um;$KITSROOT\include\$SDKVERSION\winrt;$MATLABROOT\extern\include"
        LIB="$VCINSTALLDIR\lib\x64;$VCINSTALLDIR\atlmfc\lib\x64;$KITSROOT\Lib\$SDKVERSION\ucrt\x64;$KITSROOT\lib\$SDKVERSION\um\x64;$MATLABROOT\lib\$ARCH"
        LIBPATH="$VCINSTALLDIR\lib\x64;$VCINSTALLDIR\atlmfc\lib\x64"
    />
</config>

msvcpp2019.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config
    Name="Microsoft Visual C++ 2019"
    ShortName="MSVCPP160"
    Manufacturer="Microsoft"
    Version="16.0"
    Language="C++"
    Priority="A"
    Location="$VCROOT\" >
    <Details
        CompilerExecutable="$COMPILER"
        CompilerDefines="$COMPDEFINES"
        CompilerFlags="$COMPFLAGS"
        OptimizationFlags="$OPTIMFLAGS"
        DebugFlags="$DEBUGFLAGS"
        IncludeFlags="$INCLUDE"
        LinkerExecutable="$LINKER"
        LinkerFlags="$LINKFLAGS $LINKTYPE"
        LinkerLibraries="$LINKLIBS"
        LinkerDebugFlags="$LINKDEBUGFLAGS"
        LinkerOptimizationFlags="$LINKOPTIMFLAGS"
        CommandLineShell="$VCVARSALLDIR\VCVARSALL.BAT "
        CommandLineShellArg="amd64"
        CompilerDefineFormatter="/D%s"
        LinkerLibrarySwitchFormatter="lib%s.lib;%s.lib"
        LinkerPathFormatter="/LIBPATH:%s"
        LibrarySearchPath="$$LIB;$$LIBPATH;$$PATH;$$INCLUDE;$MATLABROOT\extern\lib\$ARCH\microsoft"
    />
    <!-- Switch guide: http://msdn.microsoft.com/en-us/library/fwkeyyhe(v=vs.71).aspx -->
    <vars
        CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
        CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORTVER $OBJS $LINKLIBS /out:$EXE"
        CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
        CMDLINE300="del $EXP $LIB $MANIFEST $ILK"

        COMPILER="cl"
        COMPFLAGS="/Zp8 /GR /W3 /EHs /nologo /MD"
        COMPDEFINES="/D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0  $MATLABMEX"
        MATLABMEX=" /DMATLAB_MEX_FILE"
        OPTIMFLAGS="/O2 /Oy- /DNDEBUG"
        INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\simulink\include&quot;"
        DEBUGFLAGS="/Z7"

        LINKER="link"
        LINKFLAGS="/nologo /manifest "
        LINKTYPE="/DLL"
        LINKEXPORT="/EXPORT:mexFunction"
        LINKEXPORTVER="/EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion"
        LINKLIBS="/LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libMatlabDataArray.lib libMatlabEngine.lib"
        LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME$LDEXT.pdb&quot;"
        LINKOPTIMFLAGS=""

        OBJEXT=".obj"
        LDEXT=".mexw64"
        SETENV="set COMPILER=$COMPILER
                set COMPFLAGS=/c $COMPFLAGS $COMPDEFINES $MATLABMEX
                set OPTIMFLAGS=$OPTIMFLAGS
                set DEBUGFLAGS=$DEBUGFLAGS
                set LINKER=$LINKER
                set LINKFLAGS=$LINKFLAGS /export:%ENTRYPOINT% $LINKTYPE $LINKLIBS $LINKEXPORT
                set LINKDEBUGFLAGS=/debug /PDB:&quot;%OUTDIR%%MEX_NAME%$LDEXT.pdb&quot;
                set NAME_OUTPUT=/out:&quot;%OUTDIR%%MEX_NAME%%MEX_EXT%&quot;"
    />
    <client>
        <engine
            LINKLIBS="$LINKLIBS libeng.lib libMatlabDataArray.lib libMatlabEngine.lib"
            LINKEXPORT=""
            LINKEXPORTVER=""
            LDEXT=".exe"
            LINKTYPE=""
            MATLABMEX=""
        />
        <mbuild
            CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ /UMX_COMPAT_SC"
            CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $OBJS $LINKLIBS /out:$EXE"
            CMDLINE250="$MTCMDLINE"
            CMDLINE300="del $MANIFEST &quot;$TEMPNAME.map&quot;"
            LINKFLAGS="/nologo /manifest /DELAYLOAD:libMatlabDataArray.dll"
            LINKLIBS="/MACHINE:AMD64 /LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; libMatlabDataArray.lib libMatlabCppSharedLib.lib mclmcrrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib delayimp.lib"
            INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
            COMPFLAGS="-MD -Zp8 -GR -W3 -EHsc- -nologo"
            COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE"
            OPTIMFLAGS="-O2 -DNDEBUG"
            LINKEXPORT=""
            LINKEXPORTVER=""
            LDEXT=".exe"
            MATLABMEX=""
            MTCMDLINE="mt -outputresource:$EXE;1 -manifest $MANIFEST"
            LINKTYPE=""
            LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME.pdb&quot;"
        />
        <mbuild_com
            CMDLINE000="copy &quot;$MATLABROOT\extern\include\$ARCH\mwcomutil.tlb&quot; &quot;$OUTDIR&quot;"
            CMDLINE001="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; mwcomtypes.idl"
            CMDLINE002="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; &quot;$COMIDL&quot;"
            CMDLINE100="$COMPILER $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $COMPINCLUDE $SRC /Fo$OBJ"
            CMDLINE150="rc /fo &quot;$RESFILE&quot; &quot;$RCFILE&quot;"
            CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
            CMDLINE275="&quot;$MATLABROOT\runtime\$ARCH\mwregsvr.exe&quot; $EXE"
            CMDLINE300="del $MANIFEST &quot;$OUTDIR\mwcomutil.tlb&quot; &quot;$RESFILE&quot;"

            OUTDIR="."
            INCLUDE="$INCLUDE -I&quot;$OUTDIR&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
            COMPFLAGS="/c /GR /W3 /EHsc- /nologo /MT"
            COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE /D_SECURE_SCL=0"
            COMPINCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$OUTDIR&quot;"

            LINKEXPORT="/DLL /def:&quot;$DEFFILE&quot;"
            LINKEXPORTVER="/DLL /def:&quot;$DEFFILE&quot;"
            LINKLIBS="/MACHINE:AMD64 $LINKLIBS mclmcrrt.lib $MCLMAINLIB_MS &quot;$RESFILE&quot;"
            LDEXT=".dll"
            USERONLY=""
            LINKTYPE=""
            MATLABMEX=""
          />
    </client>
    <locationFinder>
        <VCROOT>
            <and>
                <or>
                    <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                </or>
                <cmdReturns name="set &quot;vcroot=$$&quot;&amp;for /f &quot;delims= &quot; %a in ('type &quot;$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt&quot;') do @if exist &quot;$$\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe&quot; call echo %vcroot%" />
            </and>
        </VCROOT>
        <SDKROOT>
            <or>
                <hklmExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
                <hkcuExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
                <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
                <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="InstallationFolder" />
            </or>
        </SDKROOT>
        <VSINSTALLDIR>
            <or>
                <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
            </or>
        </VSINSTALLDIR>
        <VCINSTALLDIR>
          <and>
            <or>
              <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
              <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
              <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
              <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
            </or>
            <cmdReturns name="set &quot;vcroot=$$&quot;&amp;for /f &quot;delims= &quot; %a in ('type &quot;$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt&quot;') do @if exist &quot;$$\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe&quot; call echo %vcroot%\VC\Tools\MSVC\%a" />
          </and>
        </VCINSTALLDIR>
        <VCVARSALLDIR>
           <and>
                <or>
                    <hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="16.0" />
                </or>
                <fileExists name="$$\VC\Auxiliary\Build\vcvarsall.bat" />
                <dirExists name="$$"/>
            </and>
        </VCVARSALLDIR>
        <KITSROOT>
            <or>
                <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                <hklmExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                <hkcuExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                
            </or>
        </KITSROOT>
        <SDKVERSION>
            <and>
                <or>
                    <hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    <hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    <hklmExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    <hkcuExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
                    
                </or>
                <!-- For each folder inside '<KITSROOT>\include' check for 'ucrt' and if exists return that folder name -->
                <cmdReturns name="echo off&amp;set &quot;sdkversion=&quot;&amp;(for /f %a IN ('dir &quot;$$\include\&quot; /b /ad-h /on') do ( @if exist &quot;$$\include\%a\ucrt\&quot; set &quot;sdkversion=%a&quot; ))&amp;call echo %sdkversion%" />
            </and>
        </SDKVERSION>
    </locationFinder>
    <env
        PATH="$VCINSTALLDIR\bin\HostX64\x64\;$VCROOT\Common7\IDE\VC\vcpackages;$VCROOT\Common7\IDE;$VCROOT\Common7\Tools;$SDKROOT\Bin\$SDKVERSION\x64;$SDKROOT\Bin\$SDKVERSION\x86;$SDKROOT\Bin\x64;$SDKROOT\Bin\x86;"
        INCLUDE="$VCINSTALLDIR\include;$VCINSTALLDIR\atlmfc\include;$KITSROOT\include\$SDKVERSION\ucrt;$KITSROOT\include\$SDKVERSION\shared;$KITSROOT\include\$SDKVERSION\um;$KITSROOT\include\$SDKVERSION\winrt;$MATLABROOT\extern\include"
        LIB="$VCINSTALLDIR\lib\x64;$VCINSTALLDIR\atlmfc\lib\x64;$KITSROOT\Lib\$SDKVERSION\ucrt\x64;$KITSROOT\lib\$SDKVERSION\um\x64;$MATLABROOT\lib\$ARCH"
        LIBPATH="$VCINSTALLDIR\lib\x64;$VCINSTALLDIR\atlmfc\lib\x64"
    />
</config>

或者将那两个xml文件替换为上述内容,并修改注册表
a、输入regedit
b、找到计算机\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\Sxs\VS7
新建或修改
Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler

以上两种方法应该都能解决matlab无法识别vs编译器的问题。明明安装了vs2019却说找不到支持的编译器。
这之后可以执行mex -setup命令试试

Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler文章来源地址https://www.toymoban.com/news/detail-458870.html

到了这里,关于Matlab2022a无法识别vs2019编译器,未检测到支持的编译器,错误使用Mex -setup error cannot find support compiler的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 关于UE4/UE5 无法正确使用VS2019进行编译运行(乱码报错)

            这是一个让我百思不得其解的问题,无论是上网查资料还是怎样去调整设置。总是感觉无法正确、彻底的解决。         通过学习,发现问题唯一的根源其实是VS的语言设置与你电脑系统的语言设置不兼容。我们只需要对系统的区域语言进行更改即可正常运行。如果

    2024年02月11日
    浏览(40)
  • qt qtcreator qt+vs 编译器

    对于一个新手而言,基本体会如下: Qt Creator Qt Creator优势 可以实现Ui和代码无缝切换。(VS不行) 对于汉字的支持更好 提示功能做的更好。 比如:#include等,敲出#inc即有提示。 qmake非常好用 项目管理更方便,可以添加pri之类的来管理子模块 Qt Creator劣势(IDE本身巨大劣势)

    2024年02月08日
    浏览(51)
  • 【OpenCV】VS编译器配置OpenCV库路径

            大家好呀,本篇是我在学习OpenCV库的时候一开始需要在vs2019或者vs2022编译器底下进行配置的一篇学习笔记,希望能够对OpenCV感到困惑的同学有所帮助。         废话不多说,我们直接开始吧: 目录 下载OpenCV  配置Microsoft.Cpp.x64.user文件 1.找到Microsoft.Cpp.x64.user文件

    2024年02月04日
    浏览(47)
  • 安装VS2019或VS2022不能安装的问题解决办法

    安装VS2019出现:This application requires .Net Framework 4.6 or higher to be installed   在网上查找了一下解决办法,直接进入链接下载并安装.Net 4.6: Download Microsoft .NET Framework 4.6 (Offline Installer) for Windows Vista SP2, Windows 7 SP1, Windows 8, Windows 8.1, Windows Server 2008 SP2 Windows Server 2008 R2 SP1, Windows S

    2024年02月08日
    浏览(49)
  • windows驱动开发-vs2019-vs2022 WDK开发环境搭建

    QQ群: 852283276 微信: arm80x86 微信公众号: 青儿创客基地 B站:主页 https://space.bilibili.com/208826118 好久不开发Windows驱动,现在又变天了,微软的工具更新的非常快,Visual Studio和WDK都发了新版本,推荐安装新版本,但如果非想安装老版本,也可以。Visual Studio 2022不支持Windows 1

    2024年02月04日
    浏览(69)
  • VS2022编译GDAL库报错: LINK : error LNK2001: 无法解析的外部符号 _OSRValidate _OGR_G_GetPointCount _OGRRegisterAll

    使用VS2022的Native Tools command prompt for 2022工具编译GDAL库时,报 “ LINK : error LNK2001: 无法解析的外部符号 _OSRValidate _OGR_G_GetPointCount _OGRRegisterAll ....” 错误 。该问题可能是由处理未修饰符号的AMD64 vc++编译器的更改引起的。 LINK : error LNK2001: 无法解析的外部符号 _OSRValidate LINK : er

    2024年02月07日
    浏览(37)
  • [matlab]matlab配置mingw64编译器

    第一步:下载官方绿色版本mingw64编译器然后解压放到一个非中文空格路径下面  比如我mingw64-win是我随便改的文件名,然后添加环境变量,选择用户或者系统环境变量添加下面的变量 变量名: MW_MINGW64_LOC 变量值:自己的mingw路径 最后记得重启matlab打开matlab输入 mex -setup  在输

    2024年02月11日
    浏览(44)
  • 编程小白必看!Visual Studio 2022详细安装使用教程(C/C++编译器)

    目录 【前言】 一、Visual Studio 2022简介 二、Visual Studio 2022下载安装 1.Visual Studio 2022下载地址 2.Visual Studio 2022安装 2.1下载完成后点击打开安装 2.2安装完毕以后需要重启软件,点击确定。  三、Visual Studio 2022使用教程  【最后】 🎈个人主页:库库的里昂  🎐CSDN新晋作者  🎉欢

    2024年02月13日
    浏览(52)
  • C语言调试大作战:与VS编译器共舞,上演一场“捉虫记”的艺术与科学

    少年们好,我是博主 那一脸阳光 ,我们接下来介绍C语言的调试和bug的分享。 引言: “如果你曾经在深夜与一串神秘莫测的C代码狭路相逢,彼此瞪大眼睛,犹如牛仔对决般紧张刺激;或者你曾试图驯服一段狂野不羁的循环,却发现自己陷入了一个深不见底的逻辑黑洞,那么

    2024年01月16日
    浏览(37)
  • vs2015、vs2017、vs2019、msvc自动编译脚本

    rem 记录编译时间 echo ** 版本构建开始时间: %date% %time% build.log rem 设置编译器进程名 set DstProgram=devenv.exe rem 搜索目标进程以及其目录 echo 正在搜索\\\"%DstProgram%“, 请稍候… for %%a in (“C:Program Files (x86)”, “C:Program Files”, “D:Program Files (x86)”, “D:Program Files”) do for /f “delim

    2024年02月06日
    浏览(71)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包