Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome V8 sample complie error, how can I solve ‘remove_cv_t’ is not a member of ‘std’?

Tags:

c++

v8

I am trying running samples with:

g++ -I. -Iinclude samples/hello-world.cc -o hello_world -lv8_monolith -Lout.gn/x64.release/obj/ -lrt -ldl -pthread -std=c++0x -DV8_COMPRESS_POINTERS

But I got errors:

In file included from ./include/v8.h:30:0,
                 from samples/hello-world.cc:10:
./include/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
./include/v8-internal.h:452:33: error: ‘remove_cv_t’ is not a member of ‘std’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                 ^
./include/v8-internal.h:452:33: error: ‘remove_cv_t’ is not a member of ‘std’
./include/v8-internal.h:452:50: error: template argument 2 is invalid
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                  ^
./include/v8-internal.h:452:61: error: ‘::Perform’ has not been declared
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);

I really want to use V8 engine, but I can not even compile a sample. I wish I could get your help. Thank you so much.

like image 691
Ricky Du Avatar asked Dec 14 '20 20:12

Ricky Du


1 Answers

-std=c++14 should fix it.

(The official documentation is, unfortunately, outdated in this tiny yet important detail.)

like image 171
jmrk Avatar answered Oct 17 '22 20:10

jmrk