使用 PNaCl 的命名空间 'pp' 中没有名为 'VarDictionary' 的类型

No type named 'VarDictionary' in namespace 'pp' using PNaCl

谁能解释一下为什么我会收到编译错误

error: no type named 'VarDictionary' in namespace 'pp'
        pp::VarDictionary dictionary;
        ~~~~^

我想在函数中设置字典

virtual void HandleMessage(const pp::Var& message) {
}

我复制了本 Google 页底部的示例 https://developer.chrome.com/native-client/devguide/coding/message-system

并尝试了像这样简单的事情

virtual void HandleMessage(const pp::Var& message) {
    pp::VarDictionary dictionary;
    pp::VarArray an_array;
    an_array.Set(0, pp::Var("string0"));
    an_array.Set(1, pp::Var("string1"));
    dictionary.Set(pp::Var("param_array"), an_array);
    PostMessage(dictionary);    
}

但是当我编译代码时,我得到了 pp::VarDictionary dictionary; 的错误消息,但是 pp::VarArray an_array;

没有问题

我正在使用来自 Google

的 Makefile
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

#
# GNU Make based build file.  For details on GNU Make see:
# http://www.gnu.org/software/make/manual/make.html
#

#
# Get pepper directory for toolchain and includes.
#
# If NACL_SDK_ROOT is not set, then assume it can be found three directories up.
#
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
NACL_SDK_ROOT ?= $(abspath $(dir $(THIS_MAKEFILE))../..)

# Project Build flags
WARNINGS := -Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
CXXFLAGS := -pthread -std=gnu++98 $(WARNINGS)

#
# Compute tool paths
#
GETOS := python $(NACL_SDK_ROOT)/tools/getos.py
OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py
OSNAME := $(shell $(GETOS))
RM := $(OSHELPERS) rm

PNACL_TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
PNACL_CXX := $(PNACL_TC_PATH)/bin/pnacl-clang++
PNACL_FINALIZE := $(PNACL_TC_PATH)/bin/pnacl-finalize
CXXFLAGS := -I$(NACL_SDK_ROOT)/include
LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi -ljsoncpp

#
# Disable DOS PATH warning when using Cygwin based tools Windows
#
CYGWIN ?= nodosfilewarning
export CYGWIN


# Declare the ALL target first, to make the 'all' target the default build
all: job1.pexe

clean:
    $(RM) job1.pexe job1.bc

job1.bc: job1.cc
    $(PNACL_CXX) -o $@ $< -O2 $(CXXFLAGS) $(LDFLAGS)

job1.pexe: job1.bc
    $(PNACL_FINALIZE) -o $@ $<


#
# Makefile target to run the SDK's simple HTTP server and serve this example.
#
HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py

.PHONY: serve
serve: all
    $(HTTPD_PY) -C $(CURDIR)

您需要为 var_dictionary.h 添加 header 文件,这是声明您尝试访问的 class 的地方。

header 的源代码可用 here