我想編譯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
您嘗試的代碼通常會解釋發生了什麼。您應該使用的真實代碼位於文章後面。 –