hi,
I have finish the build tutorial on google v8 project home, and build my
first cpp file opon v8 engine. I got errors like this:
undefined reference to `v8::HandleScope::HandleScope()'
--------------------------------------
my sourcecode:
#include <v8.h>
#include <assert.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
using namespace v8;
int main1() {
HandleScope handle_scope;
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
Handle<String> source = String::New("'Hello' + ', World!'");
Handle<Script> script = Script::Compile(source);
Handle<Value> result = script->Run();
context.Dispose();
String::AsciiValue ascii(result);
printf("%s\n", *ascii);
return 0;
}
Description Resource Path Location Type
undefined reference to `v8::Context::New(v8::ExtensionConfiguration*,
v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)' hellov8.cpp
/v8test/source line 18 C/C++ Problem
undefined reference to `v8::HandleScope::~HandleScope()' hellov8.cpp
/v8test/source line 31 C/C++ Problem
undefined reference to `v8::HandleScope::HandleScope()' hellov8.cpp
/v8test/source line 17 C/C++ Problem
undefined reference to `v8::Script::Compile(v8::Handle<v8::String>,
v8::ScriptOrigin*, v8::ScriptData*, v8::Handle<v8::String>)' hellov8.cpp
/v8test/source line 24 C/C++ Problem
undefined reference to `v8::Script::Run()' hellov8.cpp /v8test/source line
26 C/C++ Problem
undefined reference to `v8::String::AsciiValue::~AsciiValue()' hellov8.cpp
/v8test/source line 31 C/C++ Problem
undefined reference to
`v8::String::AsciiValue::AsciiValue(v8::Handle<v8::Value>)' hellov8.cpp
/v8test/source line 29 C/C++ Problem
undefined reference to `v8::String::New(char const*, int)' hellov8.cpp
/v8test/source line 22 C/C++ Problem
I am using eclipse, fedora64. I setup my eclipse project like this:
copy libv8.so, libv8preparser.so from the v8 root folder to
workspace/v8project/v8so/
copy include folder to workspace/v8project/include.
add do some setting in project properties -> C/C++ General -> Paths and
Symbols -> includes -> GNU C++
by there comeup an error on
/**
* Stack-allocated class which sets the execution context for all
* operations executed within a local scope.
*/
class Scope {
public:
explicit inline Scope(Handle<Context> context) : context_(context) {
context_->Enter();
}
inline ~Scope() { context_->Exit(); }
private:
Handle<Context> context_;
};
------------------------------------------- following is what i have try.
I found if I add include so file in eclipse, that error will gone instead
of "/bin/ld: cannot find -l/home/jie/workspace/v8/v8so/libv8.so"
I think there maybe some error in .so library link system. so I use "yum
update" to install a v8.so lib in my system. and create a new eclipse
project, include <v8.h>
Errors in .h file gone, but came up error log at the head of this thread.
I am about to crazy : (
-------------------------------------------
any help is much appreciated
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users