Please be aware that the example 
on https://developers.google.com/v8/get_started#intro is compatible with 
the latest stable branch. Currently this is 4.2. If you want to check out 
this branch do the following steps in your Git repo:


   1. git checkout -b 4.2 -t branch-heads/4.2
   2. gclient sync
   3. Rebuild V8
   4. Rebuild example

Cheers,
Michael

On Tuesday, May 19, 2015 at 12:14:34 PM UTC+2, Ben Noordhuis wrote:
>
> On Tue, May 19, 2015 at 11:59 AM, miser <[email protected] <javascript:>> 
> wrote: 
> > I just started learning v8, I download and build on OS X Yosemite‎, but 
> run 
> > hello_world.cpp get some errors. 
> > 
> > terminal: 
> > 
> > g++ -Iinclude hello_world.cpp -o hello_world -Wl,--start-group 
> > out/native/libv8_base.a  out/native/libv8_libbase.a 
> > out/native/libv8_snapshot.a out/native/libv8_libplatform.a 
> > out/native/libicuuc.a out/native/libicui18n.a out/native/libicudata.a 
> > -Wl,--end-group -lrt -pthread 
> > 
> > out: 
> > In file included from hello_world.cpp:1: 
> > include/v8.h:336:16: warning: alias declarations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > using Handle = Local<T>; 
> >                ^ 
> > include/v8.h:352:33: error: use of undeclared identifier 'nullptr' 
> >   V8_INLINE MaybeLocal() : val_(nullptr) {} 
> >                                 ^ 
> > include/v8.h:359:51: error: use of undeclared identifier 'nullptr' 
> >   V8_INLINE bool IsEmpty() const { return val_ == nullptr; } 
> >                                                   ^ 
> > include/v8.h:363:29: error: use of undeclared identifier 'nullptr' 
> >     out->val_ = IsEmpty() ? nullptr : this->val_; 
> >                             ^ 
> > include/v8.h:429:50: error: use of undeclared identifier 'nullptr' 
> >   bool IsFirstPass() const { return callback_ != nullptr; } 
> >                                                  ^ 
> > include/v8.h:468:29: warning: alias declarations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > using PhantomCallbackData = WeakCallbackInfo<T>; 
> >                             ^ 
> > include/v8.h:471:6: warning: scoped enumerations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > enum class WeakCallbackType { kParameter, kInternalFields }; 
> >      ^ 
> > include/v8.h:634:43: warning: deleted function definitions are a C++11 
> > extension 
> >       [-Wc++11-extensions] 
> >   PersistentBase(PersistentBase& other) = delete;  // NOLINT 
> >                                           ^ 
> > include/v8.h:635:37: warning: deleted function definitions are a C++11 
> > extension 
> >       [-Wc++11-extensions] 
> >   void operator=(PersistentBase&) = delete; 
> >                                     ^ 
> > include/v8.h:810:26: warning: rvalue references are a C++11 extension 
> >       [-Wc++11-extensions] 
> >   V8_INLINE Global(Global&& other) : PersistentBase<T>(other.val_) { 
> >                          ^ 
> > include/v8.h:818:40: warning: rvalue references are a C++11 extension 
> >       [-Wc++11-extensions] 
> >   V8_INLINE Global& operator=(Global<S>&& rhs) { 
> >                                        ^ 
> > include/v8.h:838:21: warning: deleted function definitions are a C++11 
> > extension 
> >       [-Wc++11-extensions] 
> >   Global(Global&) = delete; 
> >                     ^ 
> > include/v8.h:839:29: warning: deleted function definitions are a C++11 
> > extension 
> >       [-Wc++11-extensions] 
> >   void operator=(Global&) = delete; 
> >                             ^ 
> > include/v8.h:786:42: error: use of undeclared identifier 'nullptr' 
> >   V8_INLINE Global() : PersistentBase<T>(nullptr) {} 
> >                                          ^ 
> > include/v8.h:811:18: error: use of undeclared identifier 'nullptr' 
> >     other.val_ = nullptr; 
> >                  ^ 
> > include/v8.h:823:18: error: use of undeclared identifier 'nullptr' 
> >       rhs.val_ = nullptr; 
> >                  ^ 
> > include/v8.h:830:44: warning: rvalue references are a C++11 extension 
> >       [-Wc++11-extensions] 
> >   Global Pass() { return static_cast<Global&&>(*this); } 
> >                                            ^ 
> > include/v8.h:845:26: warning: alias declarations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > using UniquePersistent = Global<T>; 
> >                          ^ 
> > include/v8.h:1061:52: error: use of undeclared identifier 'nullptr' 
> >                             ScriptOrigin* origin = nullptr)); 
> >                                                    ^ 
> > include/v8config.h:331:48: note: expanded from macro 'V8_DEPRECATE_SOON' 
> > #define V8_DEPRECATE_SOON(message, declarator) declarator 
> >                                                ^ 
> > In file included from hello_world.cpp:1: 
> > include/v8.h:1064:30: error: use of undeclared identifier 'nullptr' 
> >       ScriptOrigin* origin = nullptr); 
> >                              ^ 
> > include/v8.h:2022:6: warning: scoped enumerations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > enum class NewStringType { kNormal, kInternalized }; 
> >      ^ 
> > include/v8.h:2230:42: error: 'v8::NewStringType' is not a class, 
> namespace, 
> > or 
> >       scoped enumeration 
> >     kNormalString = static_cast<int>(v8::NewStringType::kNormal), 
> >                                          ^ 
> > include/v8.h:2231:48: error: 'v8::NewStringType' is not a class, 
> namespace, 
> > or 
> >       scoped enumeration 
> >     kInternalizedString = 
> static_cast<int>(v8::NewStringType::kInternalized) 
> >                                                ^ 
> > include/v8.h:3083:36: error: use of undeclared identifier 'nullptr' 
> >     return NewInstance(context, 0, nullptr); 
> >                                    ^ 
> > include/v8.h:3228:6: warning: scoped enumerations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > enum class ArrayBufferCreationMode { kInternalized, kExternalized }; 
> >      ^ 
> > include/v8.h:3312:38: error: 'v8::ArrayBufferCreationMode' is not a 
> class, 
> >       namespace, or scoped enumeration 
> >       ArrayBufferCreationMode mode = 
> > ArrayBufferCreationMode::kExternalized); 
> >                                      ^ 
> > include/v8.h:4199:6: warning: scoped enumerations are a C++11 extension 
> >       [-Wc++11-extensions] 
> > enum class PropertyHandlerFlags { 
> >      ^ 
> > include/v8.h:4221:36: error: 'v8::PropertyHandlerFlags' is not a class, 
> >       namespace, or scoped enumeration 
> >       PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) 
> >                                    ^ 
> > include/v8.h:4249:36: error: 'v8::PropertyHandlerFlags' is not a class, 
> >       namespace, or scoped enumeration 
> >       PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) 
> >                                    ^ 
> > include/v8.h:6866:27: error: use of undeclared identifier 'nullptr' 
> >   if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty(); 
> >                           ^ 
> > include/v8config.h:336:54: note: expanded from macro 'V8_UNLIKELY' 
> > # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0)) 
> >                                                      ^ 
> > In file included from hello_world.cpp:1: 
> > include/v8.h:7297:46: error: 'v8::NewStringType' is not a class, 
> namespace, 
> > or 
> >       scoped enumeration 
> >   Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal) 
> >                                              ^ 
> > hello_world.cpp:8:15: error: calling a protected constructor of class 
> >       'v8::HandleScope' 
> >   HandleScope handle_scope; 
> >               ^ 
> > include/v8.h:878:13: note: declared protected here 
> >   V8_INLINE HandleScope() {} 
> >             ^ 
> > hello_world.cpp:38:1: error: unknown type name 'g' 
> > g++ -Iinclude hello_world.cpp -o hello_world -Wl,--start-group 
> out/nativ... 
> > ^ 
> > fatal error: too many errors emitted, stopping now [-ferror-limit=] 
> > 14 warnings and 20 errors generated. 
>
> Pass -std=c++11 or -std=c++0x to g++.  V8 is a C++11 project. 
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to