Openlayers 3 开放层3-名称空间“;ol";启动时已声明错误

Openlayers 3 开放层3-名称空间“;ol";启动时已声明错误,openlayers-3,google-closure-compiler,Openlayers 3,Google Closure Compiler,我使用的是关于如何开始使用开放层的说明,我得到了错误:名称空间“ol”已经声明-source ol debug.js和错误 this.Va不是一个函数-source ol.js 我确信我已经在index.html中正确地包含了ol.js、ol-debug.js和ol.css文件 打开图层js和css文件 这是ol debug.js文件中的相关部分- /** * Defines a namespace in Closure. * * A namespace may only be defin

我使用的是关于如何开始使用开放层的说明,我得到了错误:
名称空间“ol”已经声明-source ol debug.js
和错误
this.Va不是一个函数-source ol.js

我确信我已经在index.html中正确地包含了ol.js、ol-debug.js和ol.css文件

打开图层js和css文件

这是
ol debug.js
文件中的相关部分-

/**
 * Defines a namespace in Closure.
 *
 * A namespace may only be defined once in a codebase. It may be defined using
 * goog.provide() or goog.module().
 *
 * The presence of one or more goog.provide() calls in a file indicates
 * that the file defines the given objects/namespaces.
 * Provided symbols must not be null or undefined.
 *
 * In addition, goog.provide() creates the object stubs for a namespace
 * (for example, goog.provide("goog.foo.bar") will create the object
 * goog.foo.bar if it does not already exist).
 *
 * Build tools also scan for provide/require/module statements
 * to discern dependencies, build dependency files (see deps.js), etc.
 *
 * @see goog.require
 * @see goog.module
 * @param {string} name Namespace provided by this file in the form
 *     "goog.package.part".
 */
goog.provide = function(name) {
  if (goog.isInModuleLoader_()) {
    throw Error('goog.provide can not be used within a goog.module.');
  }
  if (!COMPILED) {
    // Ensure that the same namespace isn't provided twice.
    // A goog.module/goog.provide maps a goog.require to a specific file
    if (goog.isProvided_(name)) {
      throw Error('Namespace "' + name + '" already declared.');
    }
  }

  goog.constructNamespace_(name);
}; 

您需要声明
ol.js
ol debug.js
,而不是两者都声明。这个错误是因为您同时声明了这两个文件,并且创建了一个名称空间冲突。

我很确定我已经包含了ol.js、ol-debug.js和ol.css
包含了ol.js或ol-debug.js,而不是两者,这是一个问题!谢谢,哈哈。明白了。。。很乐意帮助你,你想提供你自己的答案吗?