xmba15 / onnx_runtime_cpp

small c++ library to quickly deploy models using onnxruntime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OrtSessionHandler.hpp:15:20: fatal error: optional: No such file or directory

tcxia opened this issue · comments

#include <onnxruntime/core/providers/cuda/cuda_provider_factory.h>
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
因为这两个文件报错?

Hi,
Have you used my script to install onnxruntime from source?

Also in CmakeLists you also need to specify onnxruntime_INCLUDE_DIRS, like this

set(onnxruntime_INSTALL_PREFIX /usr/local)
set(onnxruntime_INCLUDE_DIRS
  ${onnxruntime_INSTALL_PREFIX}/include/onnxruntime
  ${onnxruntime_INSTALL_PREFIX}/include/onnxruntime/core/session
)

and include it

I have installed it, but I can't find the #include file. It seems to be C++17 only!

yes. I have used some small functions (std::optional) of C++17, so currently support C++17 only. Those parts of C++17 can be rewritten into C++11 actually. Please test with C++17 first. If you need to port it into C++11, I can help.

@xmba15 I've already rewritten it for c++14. I'll test it later. Thank you

I will close the issue now. Feel free to open it again if troubles happen.

@tcxia Hello, Do you mind sharing what did you change to compile it in C++14?

Solved. Just in case anyone need.

std::optional to boost::optional
std::nullopt to boost::none
.has_value to .is_initialized()