You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<onnxruntime_c_api.h>
#include<iostream>
#include<vector>intmain() {
// Initialize ONNX Runtime environment
std::cout << "Initializing ONNX Runtime..." << std::endl;
/* try { // Create an ONNX Runtime session options object onnxruntime::SessionOptions session_options; // Create ONNX session onnxruntime::InferenceSession onnx_session(session_options); // Specify the path to the ONNX model const std::string model_path = "RFModel.onnx"; // Replace with your model path onnx_session.Load(model_path); std::cout << "Model loaded successfully!" << std::endl; // Prepare input and output tensors (you need to provide input data here) std::vector<onnxruntime::InputTensor> input_tensors; // Set up input tensors (prepare data) std::vector<onnxruntime::OutputTensor> output_tensors; // Prepare output tensors // Run inference onnx_session.Run(input_tensors, output_tensors); std::cout << "Inference completed!" << std::endl; } catch (const std::exception &e) { std::cerr << "Error: " << e.what() << std::endl; }*/return0;
}
To run I am using the command:
g++ -O3 trial_onnx.cpp -I"C:/Users/moniq/Downloads/onnxruntime/include" -L"C:/Users/moniq/Downloads/onnxruntime/lib" -lonnxruntime -o out
Describe the issue
I installed the Runtime precompiled binaries from
https://github.com/microsoft/onnxruntime/releases.
Now I am trying to use them inside a C++ file on Visual Studio Code. The code is
To run I am using the command:
g++ -O3 trial_onnx.cpp -I"C:/Users/moniq/Downloads/onnxruntime/include" -L"C:/Users/moniq/Downloads/onnxruntime/lib" -lonnxruntime -o out
However I am getting errors like:
C:/Users/moniq/Downloads/onnxruntime/include/onnxruntime_c_api.h:310:30: error: typedef 'Return_type_success' is initialized (use decltype instead)
typedef Return_type_success(return == 0) OrtStatus* OrtStatusPtr;
Is this because Onnx is not compatible with g++?
To reproduce
I would not like to change the compiler. Is there a remedy for this?
Urgency
No response
Platform
Windows
OS Version
24h2
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
latest
ONNX Runtime API
C++
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: