onnxruntime
onnxruntime copied to clipboard
[Build] “onnxruntime_cxx_api.h”: No such file or directory
Describe the issue
OS: Windows ONNX Runtime version: 1.19.1 CUDA version: 12.6 cuDNN version: 9.3.0
I'm using the following packages. But vs2022 can't find “onnxruntime_cxx_api.h”
Urgency
No response
Target platform
Windows 10 22H2
Build script
None
Error / output
error C1083: Cannot open include file: “onnxruntime_cxx_api.h”: No such file or directory
Visual Studio Version
VS2022 17.10.5
GCC / Compiler Version
MSVC 14.40.33807
Following up on this, having the same problem! This issue arises installing ONNXRuntime for GPU using NuGet in VS2022, apparently the folder structure of the GPU packages is a bit different from the main one, and it can't find the header files.
Me neither, same environment.
Just to revive the discussion: I managed to solve this by manually downloading the ONNXRuntime GPU release, and setting the correct path for includes and libs in the VS project. However, it would be nice to have working NuGet packages for C++ without manual intervention, or know how to make them work.
Hey, I had the same issue before Now it's fixed here is the solution
Windows
param([string]$Version="1.22.2") $Root="C:\onnxruntime\$Version" $Zip="$env:TEMP\onnxruntime-win-x64-gpu-$Version.zip" Invoke-WebRequest -Uri "https://downloads.sourceforge.net/project/onnx-runtime.mirror/v$Version/onnxruntime-win-x64-gpu-$Version.zip" -OutFile $Zip -UseBasicParsing Expand-Archive -Force -Path $Zip -DestinationPath $env:TEMP New-Item -Force -ItemType Directory -Path $Root | Out-Null Copy-Item -Recurse -Force "$env:TEMP\onnxruntime-win-x64-gpu-$Version\*" $Root [Environment]::SetEnvironmentVariable("ONNXRUNTIME_DIR",$Root,[EnvironmentVariableTarget]::Machine) $paths=([Environment]::GetEnvironmentVariable("Path","Machine") -split ";")|Where-Object{$_ -ne ""} $add=@("$Root\bin","$Root\lib")|Where-Object{$_ -notin $paths} if($add.Count -gt 0){[Environment]::SetEnvironmentVariable("Path",($paths+$add -join ";"),[EnvironmentVariableTarget]::Machine)}
Linux
#!/usr/bin/env bash set -e VER="${1:-1.22.2}"; ROOT="/opt/onnxruntime/$VER"; TMP="$(mktemp -d)" mkdir -p "$TMP" && cd "$TMP" wget -q "https://downloads.sourceforge.net/project/onnx-runtime.mirror/v$VER/onnxruntime-linux-x64-gpu-$VER.tgz" tar -xzf "onnxruntime-linux-x64-gpu-$VER.tgz" sudo mkdir -p "$ROOT" && sudo cp -r "onnxruntime-linux-x64-gpu-$VER/"* "$ROOT/" echo "$ROOT/lib" | sudo tee /etc/ld.so.conf.d/onnxruntime-$VER.conf >/dev/null echo "export ONNXRUNTIME_DIR=$ROOT" | sudo tee /etc/profile.d/onnxruntime-$VER.sh >/dev/null echo 'export PATH="$ONNXRUNTIME_DIR/bin:$PATH"' | sudo tee -a /etc/profile.d/onnxruntime-$VER.sh >/dev/null echo 'export LD_LIBRARY_PATH="$ONNXRUNTIME_DIR/lib:${LD_LIBRARY_PATH:-}"' | sudo tee -a /etc/profile.d/onnxruntime-$VER.sh >/dev/null sudo ldconfig
Applying stale label due to no activity in 30 days
Applying stale label due to no activity in 30 days
Closing issue due to no activity in 30 days