skip to Main Content

I am developing a code in C++ using as IDEE Visual Studio 2017 on my Windows 10 workstation. I need the onnxruntime library, so I have installed it by the NuGet package menager. The installation went ok and in my solution I have a folder Resource files and within it I have the file packages.config. Its content is:

   <?xml version="1.0" encoding="utf-8"?>
   <packages>
     <package id="Microsoft.ML.OnnxRuntime" version="1.12.1" targetFramework="native" />
</packages>

My main.cpp is quite simple. It is a simple hello world where I try to use the installed package. But when I compile, it gives me an error on the using Microsoft.ML.OnnxRuntime; directive. I have followed the instructions in https://learn.microsoft.com/en-us/nuget/consume-packages/overview-and-workflow.

#include <iostream>

using namespace std;
using Microsoft.ML.OnnxRuntime;

int main()
{
    cout<<"Hello worldn"

    return 0;
}

2

Answers


  1. You can’t. That package is for .NET C#. You are trying to use a .NET package with C++ (which you can’t)

    Perhaps consider switching to C#?

    Login or Signup to reply.
  2. OnnxRuntime lib and dll can be found in folder YourprojectpackagesMicrosoft.ML.OnnxRuntime.XXXruntimeswin-x64native.Header file folder XXXpackagesMicrosoft.ML.OnnxRuntime.XXXbuildnativeinclude
    Try adding them as dependencies.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search