onnx-tensorrt icon indicating copy to clipboard operation
onnx-tensorrt copied to clipboard

error: 'numeric_limits' is not a member of 'std'

Open cloudhan opened this issue 5 years ago • 4 comments

# gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~16.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Got following error:

In file included from /opt/onnx-tensorrt/main.cpp:24:0:
/opt/onnx-tensorrt/onnx_utils.hpp: In function 'bool ParseFromFile_WAR(google::protobuf::Message*, const char*)':
/opt/onnx-tensorrt/onnx_utils.hpp:147:41: error: 'numeric_limits' is not a member of 'std'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                         ^~~~~~~~~~~~~~
/opt/onnx-tensorrt/onnx_utils.hpp:147:56: error: expected primary-expression before 'int'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                                        ^~~
/opt/onnx-tensorrt/onnx_utils.hpp:147:74: error: 'numeric_limits' is not a member of 'std'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                                                          ^~~~~~~~~~~~~~
/opt/onnx-tensorrt/onnx_utils.hpp:147:89: error: expected primary-expression before 'int'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                                                                         ^~~
In file included from /opt/onnx-tensorrt/getSupportedAPITest.cpp:29:0:
/opt/onnx-tensorrt/onnx_utils.hpp: In function 'bool ParseFromFile_WAR(google::protobuf::Message*, const char*)':
/opt/onnx-tensorrt/onnx_utils.hpp:147:41: error: 'numeric_limits' is not a member of 'std'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                         ^~~~~~~~~~~~~~
/opt/onnx-tensorrt/onnx_utils.hpp:147:56: error: expected primary-expression before 'int'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                                        ^~~
/opt/onnx-tensorrt/onnx_utils.hpp:147:74: error: 'numeric_limits' is not a member of 'std'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                                                          ^~~~~~~~~~~~~~
/opt/onnx-tensorrt/onnx_utils.hpp:147:89: error: expected primary-expression before 'int'
     coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), std::numeric_limits<int>::max() / 4);
                                                                                         ^~~
CMakeFiles/getSupportedAPITest.dir/build.make:82: recipe for target 'CMakeFiles/getSupportedAPITest.dir/getSupportedAPITest.cpp.o' failed

cloudhan avatar Jun 05 '20 12:06 cloudhan

open onnx_utils.hpp and add heads: #include <stdexcept> #include <limits>

Tian14267 avatar Jul 01 '20 01:07 Tian14267

Oops. I'll make a PR addressing this.

kevinch-nv avatar Apr 17 '21 21:04 kevinch-nv

#include <limits> // std::numeric_limits

esdrasdemorais avatar Nov 20 '21 01:11 esdrasdemorais

@Tian14267,good job,thanks

JcakLee avatar Dec 01 '22 05:12 JcakLee