我想编译V8的hello世界示例,并且我一直运行到编译时错误。下面是代码:V8编译错误的基本示例
#include <v8/src/v8.h>
using namespace v8;
int main(int argc, char* argv[]) {
// Create a string holding the JavaScript source code.
String source = String::New("Hi");
// Compile it.
Script script = Script::Compile(source) ;
// Run it.
Value result = script->Run();
// Convert the result to an ASCII string and display it.
String::AsciiValue ascii(result) ;
printf("%s\n", *ascii) ;
return 0;
}
这是编译错误:
error: conversion from ‘v8::Local<v8::String>’ to non-scalar type ‘v8::String’ requested
误差为线8,其中它说:字符串源=字符串::新( “你好”);
我试过google'ing这个错误没有意义,并且似乎无法找到修复它是有道理的。有任何想法吗?
我曾经尝试都:
svn签http://v8.googlecode.com/svn/trunk/ V8
和
svn签http://v8.googlecode.com/svn/branches/bleeding_edge/ V8
,并得到了同样的错误两种。
哪条线给你的错误? – AnT
错误在第8行。我更新了帖子以反映这一点。 – user396404
您尝试的代码通常会解释发生了什么。您应该使用的真实代码位于文章后面。 –