Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of onnx with g++ #23304

Closed
MoniqueSciortino opened this issue Jan 9, 2025 · 4 comments
Closed

Compatibility of onnx with g++ #23304

MoniqueSciortino opened this issue Jan 9, 2025 · 4 comments

Comments

@MoniqueSciortino
Copy link

MoniqueSciortino commented Jan 9, 2025

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

#include <onnxruntime_c_api.h>
#include <iostream>
#include <vector>

int main() {
    // 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;
    }
    */
    return 0;
}

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

@snnn
Copy link
Member

snnn commented Jan 9, 2025

On Windows we do not support GCC. Please use Visual Studio. Or use WSL, or Linux.

@snnn snnn closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2025
@MoniqueSciortino
Copy link
Author

What about on Mac? Is gcc supported?

@snnn
Copy link
Member

snnn commented Jan 9, 2025

No. Only XCode which is clang based.

@MoniqueSciortino
Copy link
Author

Thank you for your replies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants