v8js icon indicating copy to clipboard operation
v8js copied to clipboard

compile error with g++ 13: error: expected unqualified-id before '&' token

Open rbro opened this issue 2 years ago • 0 comments

When compiling v8js on Fedora 38 which has g++ 13.1.1, I'm getting errors:

/tmp/v8js/v8js_object_export.cc:712:72: error: expected unqualified-id before '&' token
  712 |                                         catch (const std::out_of_range &) {
      |                                                                        ^
/tmp/v8js/v8js_object_export.cc:712:71: error: expected ')' before '&' token
  712 |                                         catch (const std::out_of_range &) {
      |                                               ~                       ^~
      |                                                                       )
/tmp/v8js/v8js_object_export.cc:712:72: error: expected '{' before '&' token
  712 |                                         catch (const std::out_of_range &) {
      |                                                                        ^
/tmp/v8js/v8js_object_export.cc:712:73: error: expected primary-expression before ')' token
  712 |                                         catch (const std::out_of_range &) {
      |                                                                         ^

I'm not very familiar with c++, but I was able to resolve it by adding this to the top of v8js_object_export.cc:

#include <stdexcept>

Is this the right way to fix it?

Thanks for your help.

rbro avatar Jul 09 '23 20:07 rbro