0
votes

I came across looser throw specifier error and overriding error while compiling caffe related code. I do not know what these two kind of error is and why they pop out together and how to fix them. This is my error log:

/usr/local/include/boost/system/error_code.hpp:233:21: error: looser throw specifier for ‘virtual const char* boost::system::error_category::std_category::name() const’
virtual const char * name() const BOOST_NOEXCEPT

           ^ 

/usr/include/c++/4.9/system_error:81:21: error: overriding ‘virtual const char* std::error_category::name() const noexcept’

name() const noexcept = 0;

              ^

And this is the compile script:

#!/bin/sh

source=deep_image_analogy/source

nvcc $source/*.cpp $source/*.cu -o demo \
        -std=c++11 \
        -I./include \
        -L./build/lib \
        -lopencv_core \
        -lopencv_highgui \
        -lopencv_imgproc \
        -lboost_system \
        -lcublas \
        -lcaffe \
        -lglog

Thanks!

1
I'm not familiar with boost but the error seems to be saying that the method you are overriding has a looser (less strong) throw specifier (BOOST_NOEXCEPT) than your override declaration. I would try changing your declaration to be tagged BOOST_NOEXCEPT instead of noexcept. - define cindy const
Thanks@definecindyconst , I'll try with that - Rickyim

1 Answers

-1
votes

I've run into the same problem when compiling Deep Image Analogy on Ubuntu 17.10 + CUDA 8 + GCC 5, and I finally found a solution. This boost ticket helped me to solve the issue: #13049

You should look for the boost nvcc.hpp config file (in my system it was located at /usr/local/include/boost/config/compiler/nvcc.hpp) and then add the following line:

#define DBOOST_NO_CXX11_NOEXCEPT

There is actually a reference to the #13049 ticket on that configuration file (line 50). Hope this helps!