fatal+error+RC1107:+invalid+usage;+use+RC+/?+for+Help

本文解决了一个关于新建MFCDialog项目无法使用资源视图的问题。通过调整包含文件路径中的斜杠符号,成功修复了fatalerrorRC1107:invalidusage错误。

今天莫名其妙地遇到这个问题。新建的MFC Dialog 项目都无法使用资源视图,“fatal error RC1107: invalid usage; use RC /? for Help”

经过一番Google,暂时解决如下:
“工具”->"选项"->"项目和解决方案"->"VC++ 目录" : "包含文件" 里面的条目如果有绝对路径(比如我的"C:/Boost/include/boost-1_33_1"),把其中的反斜线(/)替换为双反斜线(//)或者替换为斜线(/ 这个是我实验出来的,我喜欢这样,兼容Linux风格)。

至于原因,大概是VC8传递给 rcdll.dll 的命令行参数有问题,是一个Bug。具体参看大牛的分析 。


http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/e4ef7904-0947-4792-aa4a-b28077146d02/

The bug happens in the IDE. The IDE passes the command line to rcdll.dll when calling the exported functions RC and RCW. Its passed as the 5th parameter. I'm not sure how much of the IDE code is running in .NET, but I couldn't get much call history from the stack. The command line may have originated in resedit.dll.

The command line that cause the problem is below. Note the quote after P: in the middle of the text.

PlatformSDK/bin/rcdll.dll./s./x./I.D:/Program Files/Microsoft Visual Studio 8/VC/include;D:/Program Files/Microsoft Visual Studio 8/VC/atlmfc/include;D:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/include;D:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/common/include;D:/Program Files/Microsoft Visual Studio 8/SDK/v2.0/include;E:/ArmourSoft/SourceSafe2004;P:" /r /FO E:/ArmourSoft/SourceSafe2005/Projects/SmartSafe_5.0/ArmourSoft/FileSafe/ASCipher/ASCipher.aps /L 0x809 E:/ArmourSoft/SourceSafe2005/Projects/SmartSafe_5.0/ArmourSoft/FileSafe/ASCipher/ASCipher.rc

- Andy

http://blog.youkuaiyun.com/cuglij/article/details/3725211

今天莫名其妙地遇到这个问题。新建的MFC Dialog 项目都无法使用资源视图,“fatal error RC1107: invalid usage; use RC /? for Help”

经过一番Google,暂时解决如下:
“工具”->"选项"->"项目和解决方案"->"VC++ 目录" : "包含文件" 里面的条目如果有绝对路径,去掉路径最后的 "\"

至于原因,大概是判断路径是否存在时用了 access 导致多个 \ ,判断路径不存在了。

很奇怪的是以前创建的工程还是可以的,只是新建工程不行,不知道是不是和最近装的2008有关

Google了一下,http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=123870&SiteID=1

原因是Tools->Options->VC++Directories->Include Files中有以/结尾的路径; rc.exe会把最后的/换成", 但开头没有对应的引号, 所以解析错误. 把路径最后的/去掉就好了.

VC默认的包含路径都不是以/结尾的, 所以该错误一般发生在自己添加的路径上(比如DirectX的头文件路径).



PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 查找最新 Windows SDK 库路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $sdkLibPath = @( >> "${env:ProgramFiles(x86)}\Windows Kits\10\Lib", >> "${env:ProgramFiles}\Windows Kits\10\Lib" >> ) | Where-Object { Test-Path $_ } | Select-Object -First 1 (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 获取最新版本路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $latestSdkVersion = Get-ChildItem -Path $sdkLibPath | >> Where-Object { $_.Name -match '^\d+\.\d+' } | >> Sort-Object { [version]$_.Name } -Descending | >> Select-Object -First 1 (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> if ($latestSdkVersion) { >> $umPath = Join-Path $latestSdkVersion.FullName "um\x64" >> $ucrtPath = Join-Path $latestSdkVersion.FullName "ucrt\x64" >> >> # 添加到环境变量 >> $env:LIB = "$umPath;$ucrtPath;$env:LIB" >> $env:INCLUDE = "$(Join-Path $latestSdkVersion.FullName 'um');$(Join-Path $latestSdkVersion.FullName 'ucrt');$env:INCLUDE" >> >> Write-Host "已添加 LIB 路径: $umPath, $ucrtPath" >> Write-Host "已添加 INCLUDE 路径: $(Join-Path $latestSdkVersion.FullName 'um')" >> } else { >> Write-Host "错误: 未找到 Windows SDK 库路径" -ForegroundColor Red >> } 已添加 LIB 路径: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64, C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64 已添加 INCLUDE 路径: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 验证关键工具可用性 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $tools = @("cl.exe", "link.exe", "rc.exe", "mt.exe", "nvcc.exe") (rtx5070_env) PS E:\PyTorch_Build\pytorch> $missingTools = @() (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> foreach ($tool in $tools) { >> if (-not (Get-Command $tool -ErrorAction SilentlyContinue)) { >> $missingTools += $tool >> } >> } (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> if ($missingTools.Count -gt 0) { >> Write-Host "缺失工具: $($missingTools -join ', ')" -ForegroundColor Red >> Write-Host "当前 PATH: $env:PATH" >> } else { >> Write-Host "所有必要工具已配置" -ForegroundColor Green >> } 缺失工具: cl.exe, link.exe, rc.exe, mt.exe 当前 PATH: E:\PyTorch_Build\pytorch\rtx5070_env\Scripts;C:\Program Files\PowerShell\7;C:\Miniconda3\condabin;C:\Miniconda3\Scripts;E:\PyTorch_Build\pytorch\pytorch_env\Scripts;C:\Program Files\PowerShell\7;E:\PyTorch_Build\pytorch\pytorch_env\Scripts;C:\Program Files\PowerShell\7;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;;E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch\lib;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;C:\Users\Administrator\AppData\Local\Microsoft\dotnet;C:\Users\Administrator\AppData\Local\Microsoft\dotnet;C:\Users\Administrator\AppData\Local\Microsoft\dotnet\;C:\Program Files\dotnet;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;E:\Python310;C:\Program Files\dotnet\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;E:\Python310\Scripts;E:\Python310\Scripts;C:\Program Files\PowerShell\7\;E:\Program Files\Microsoft VS Code\bin;E:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2025.3.0\;E:\Program Files\CMake\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Incredibuild;E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch\lib;E:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\ProgramData\chocolatey\bin;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\miniconda3\Scripts;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\miniconda3\Scripts;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\ProgramData\mingw64\mingw64\bin (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 获取 SDK 版本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $sdkVersion = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\Include" | >> Where-Object { $_.PSIsContainer -and $_.Name -match '^\d+\.\d+\.\d+' } | >> Sort-Object { [version]$_.Name } -Descending | >> Select-Object -First 1 -ExpandProperty Name (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> $cmakeArgs = @( >> "-G Ninja", >> "-DCMAKE_BUILD_TYPE=Release", >> "-DCMAKE_C_COMPILER=cl.exe", >> "-DCMAKE_CXX_COMPILER=cl.exe", >> "-DCMAKE_CUDA_COMPILER=E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe", >> "-DCMAKE_CUDA_HOST_COMPILER=cl.exe", >> "-DCMAKE_SYSTEM_VERSION=$sdkVersion", # 关键: 指定 SDK 版本 >> "-DCUDA_NVCC_FLAGS=-Xcompiler /wd4819 -gencode arch=compute_89,code=sm_89", >> "-DTORCH_CUDA_ARCH_LIST=8.9", >> "-DUSE_CUDA=ON", >> "-DUSE_NCCL=OFF", >> "-DUSE_DISTRIBUTED=OFF", >> "-DBUILD_TESTING=OFF", >> "-DBLAS=OpenBLAS", >> "-DCUDA_TOOLKIT_ROOT_DIR=E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0", >> "-DCUDNN_ROOT_DIR=E:/Program Files/NVIDIA/CUDNN/v9.12", >> "-DPYTHON_EXECUTABLE=$((Get-Command python).Source)", >> # 显式指定库路径 >> "-DCMAKE_LIBRARY_PATH=C:/Program Files (x86)/Windows Kits/10/Lib/$sdkVersion/um/x64", >> "-DCMAKE_INCLUDE_PATH=C:/Program Files (x86)/Windows Kits/10/Include/$sdkVersion/um" >> ) (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> cmake .. @cmakeArgs CMake Warning: Ignoring extra path from command line: ".." CMake Error: The source directory "E:/PyTorch_Build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 加载完整 VC 环境 (rtx5070_env) PS E:\PyTorch_Build\pytorch> & "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.4 -winsdk=10.0.22621.0 [ERROR:vcvarsall.bat] Invalid argument found : .4 [ERROR:vcvarsall.bat] Invalid argument found : -winsdk=10 [ERROR:vcvarsall.bat] Invalid argument found : .0.22621.0 [ERROR:vcvarsall.bat] Error in script usage. The correct usage is: Syntax: vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode] where : [arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64 [platform_type]: {empty} | store | uwp [winsdk_version] : full Windows 10 SDK number (e.g. 10.0.10240.0) or "8.1" to use the Windows 8.1 SDK. [vc_version] : {none} for latest installed VC++ compiler toolset | "14.0" for VC++ 2015 Compiler Toolset | "14.xx" for the latest 14.xx.yyyyy toolset installed (e.g. "14.11") | "14.xx.yyyyy" for a specific full version number (e.g. "14.11.25503") [spectre_mode] : {none} for libraries without spectre mitigations | "spectre" for libraries with spectre mitigations The store parameter sets environment variables to support Universal Windows Platform application development and is an alias for 'uwp'. For example: vcvarsall.bat x86_amd64 vcvarsall.bat x86_amd64 10.0.10240.0 vcvarsall.bat x86_arm uwp 10.0.10240.0 vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0 vcvarsall.bat x64 8.1 vcvarsall.bat x64 store 8.1 Please make sure either Visual Studio or C++ Build SKU is installed. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 验证环境 (rtx5070_env) PS E:\PyTorch_Build\pytorch> cl.exe cl.exe: The term 'cl.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> link.exe link.exe: The term 'link.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 设置 CUDA 路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:CUDA_PATH = "E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:PATH = "$env:CUDA_PATH/bin;$env:PATH" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 直接运行 CMake (rtx5070_env) PS E:\PyTorch_Build\pytorch> cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DUSE_CUDA=ON ... CMake Warning: Ignoring extra path from command line: "E:/PyTorch_Build" CMake Warning: Ignoring extra path from command line: ".." -- The CXX compiler identification is GNU 13.2.0 -- The C compiler identification is GNU 13.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/ProgramData/mingw64/mingw64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/ProgramData/mingw64/mingw64/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Not forcing any particular BLAS to be found CMake Warning at CMakeLists.txt:418 (message): TensorPipe cannot be used on Windows. Set it to OFF CMake Warning at CMakeLists.txt:430 (message): Libuv is not installed in current conda env. Set USE_DISTRIBUTED to OFF. Please run command 'conda install -c conda-forge libuv=1.39' to install libuv. -- Performing Test C_HAS_AVX_1 -- Performing Test C_HAS_AVX_1 - Failed -- Performing Test C_HAS_AVX_2 -- Performing Test C_HAS_AVX_2 - Success -- Performing Test C_HAS_AVX2_1 -- Performing Test C_HAS_AVX2_1 - Failed -- Performing Test C_HAS_AVX2_2 -- Performing Test C_HAS_AVX2_2 - Success -- Performing Test C_HAS_AVX512_1 -- Performing Test C_HAS_AVX512_1 - Failed -- Performing Test C_HAS_AVX512_2 -- Performing Test C_HAS_AVX512_2 - Success -- Performing Test CXX_HAS_AVX_1 -- Performing Test CXX_HAS_AVX_1 - Failed -- Performing Test CXX_HAS_AVX_2 -- Performing Test CXX_HAS_AVX_2 - Success -- Performing Test CXX_HAS_AVX2_1 -- Performing Test CXX_HAS_AVX2_1 - Failed -- Performing Test CXX_HAS_AVX2_2 -- Performing Test CXX_HAS_AVX2_2 - Success -- Performing Test CXX_HAS_AVX512_1 -- Performing Test CXX_HAS_AVX512_1 - Failed -- Performing Test CXX_HAS_AVX512_2 -- Performing Test CXX_HAS_AVX512_2 - Success -- Current compiler supports avx2 extension. Will build perfkernels. -- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS -- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS - Success -- Current compiler supports avx512f extension. Will build fbgemm. -- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY -- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_SUPPORTS_RDYNAMIC -- Performing Test COMPILER_SUPPORTS_RDYNAMIC - Failed -- Found CUDA: E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0 (found version "13.0") CMake Error at E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:928 (message): Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed. Compiler: E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe Build flags: Id flags: --keep;--keep-dir;tmp -v The output was: 1 nvcc fatal : Cannot find compiler 'cl.exe' in PATH Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed. Compiler: E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe Build flags: -DLIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_OPERATIONS;-Xfatbin;-compress-all Id flags: --keep;--keep-dir;tmp -v The output was: 1 nvcc fatal : Cannot find compiler 'cl.exe' in PATH Call Stack (most recent call first): E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD) E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test) E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCUDACompiler.cmake:162 (CMAKE_DETERMINE_COMPILER_ID) cmake/public/cuda.cmake:47 (enable_language) cmake/Dependencies.cmake:43 (include) CMakeLists.txt:853 (include) -- Configuring incomplete, errors occurred! (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 创建测试文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> @' >> #include <iostream> >> int main() { >> std::cout << "Hello from C++ & CUDA toolchain!" << std::endl; >> return 0; >> } >> '@ | Set-Content test.cpp (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 编译测试 (rtx5070_env) PS E:\PyTorch_Build\pytorch> cl.exe test.cpp /EHsc /link kernel32.lib user32.lib gdi32.lib cl.exe: The term 'cl.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> if (Test-Path test.exe) { >> .\test.exe >> } else { >> Write-Host "编译失败,错误信息:" >> cl.exe test.cpp /EHsc /link kernel32.lib /v >> } 编译失败,错误信息: cl.exe: Line | 5 | cl.exe test.cpp /EHsc /link kernel32.lib /v | ~~~~~~ | The term 'cl.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 设置基本环境变量 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:CUDA_PATH = "E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:CUDNN_PATH = "E:/Program Files/NVIDIA/CUDNN/v9.12" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:OpenBLAS_HOME = "E:/Libs/OpenBLAS_Prebuilt" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:PATH = "$env:CUDA_PATH/bin;$env:OpenBLAS_HOME/bin;$env:PATH" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 加载 Visual Studio 环境 (rtx5070_env) PS E:\PyTorch_Build\pytorch> & "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" ********************************************************************** ** Visual Studio 2022 Developer Command Prompt v17.14.13 ** Copyright (c) 2025 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x64' (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 添加编译器路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $clPath = "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:PATH = "$clPath;$env:PATH" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 4. 修复 Windows SDK 库路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\fix_kernel32_error.ps1 .\fix_kernel32_error.ps1: The term '.\fix_kernel32_error.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 5. 验证工具链 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\verify_toolchain.ps1 .\verify_toolchain.ps1: The term '.\verify_toolchain.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 6. 准备构建目录 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Location E:\PyTorch_Build\pytorch (rtx5070_env) PS E:\PyTorch_Build\pytorch> Remove-Item build -Recurse -Force -ErrorAction SilentlyContinue (rtx5070_env) PS E:\PyTorch_Build\pytorch> New-Item -Path build -ItemType Directory | Out-Null (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Location build (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> # 7. 配置 CMake (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> .\cmake_configure_final.ps1 .\cmake_configure_final.ps1: The term '.\cmake_configure_final.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> # 8. 编译和安装 (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> if ($LASTEXITCODE -eq 0) { >> cmake --build . --config Release --parallel 8 >> if ($LASTEXITCODE -eq 0) { >> cmake --install . >> } >> } Error: not a CMake build directory (missing CMakeCache.txt) (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> # 9. 验证安装 (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> python -c "import torch; print(f'PyTorch版本: {torch.__version__}'); print(f'CUDA可用: {torch.cuda.is_available()}')" PyTorch版本: 2.8.0+cpu CUDA可用: False (rtx5070_env) PS E:\PyTorch_Build\pytorch\build>
最新发布
09-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值