我正在尝试编译一个名为“triangle”的库。为此我需要 C++ 构建工具。我已经安装了这些,但是当我打开 vs 2022 的开发人员命令提示符时,出现以下错误
Active code page: 936
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.9.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[ERROR:VsDevCmd.bat] Script "vsdevcmd\ext\Active" could not be found.
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***
[ERROR:VsDevCmd.bat] In an uninitialized command prompt, please 'set VSCMD_DEBUG=[value]' and then re-run
[ERROR:VsDevCmd.bat] vsdevcmd.bat [args] for additional details.
[ERROR:VsDevCmd.bat] Where [value] is:
[ERROR:VsDevCmd.bat] 1 : basic debug logging
[ERROR:VsDevCmd.bat] 2 : detailed debug logging
[ERROR:VsDevCmd.bat] 3 : trace level logging. Redirection of output to a file when using this level is recommended.
[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3
[ERROR:VsDevCmd.bat] vsdevcmd.bat > vsdevcmd.trace.txt 2>&1
编译“三角形”时出现以下错误:
building 'triangle.core' extension
cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DVOID=void -DREAL=double -DNO_TIMER=1 -DTRILIBRARY=1 -DANSI_DECLARATORS=1 -Ic -IE:\anaconda\envs\py39env\include -IE:\anaconda\envs\py39env\Include /Tcc/triangle.c /Fobuild\temp.win-amd64-cpython-39\Release\c/triangle.obj
error: command 'cl.exe' failed: None
已修复! 问题是因为这条线
Active code page: 936
解决方案:
Start -> Run -> regedit
[HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun]
@chcp 936>nul
只需将 >nul
放在代码页值的末尾,这样命令提示符在运行时就不会产生任何输出