问题标签 [redeclaration]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
8842 浏览

c - 重新声明中的类型不匹配

除了这个 C 程序中的这 5 个错误(粘贴时间太长,因此提供链接)之外,我已经能够删除几乎所有错误。

http://codepad.org/AfqrDojN

我收到的错误如下:

截屏

我正在使用以下库:

可能是什么问题?

0 投票
3 回答
3037 浏览

swift - Swift 1.2 redeclares Objective-C method

I just updated from swift 1.1 to swift 1.2 and get compiler Error:

Here some code:

But I need call setVacation

Is any suggestions how fix this?

0 投票
0 回答
951 浏览

enums - Redeclaration of enumerator - conflicting types

I'm having a problem with my enums..

In my header file i declare the enums as followed:

In my c file i declare them as followed:

In all other c files i dont redeclare them, i just use them as followed:

The errors are:

  • conflicting types for 'envelop_status_type'
  • conflicting types for 'envelop_status'
  • conflicting types for 'envelop_status'
  • conflicting types for 'ZCD_status_type'
  • conflicting types for 'ZCD_status'
  • conflicting types for 'ZCD_status'
  • redeclaration of enumerator 'busy'
  • redeclaration of enumerator 'done'
  • redeclaration of enumerator 'error'
  • redeclaration of enumerator 'not_received'
  • redeclaration of enumerator 'received'
  • redeclaration of enumerator 'restart'

as environment i'm using LPCXpresso and i'm programming an LPC1343 µController.

0 投票
0 回答
97 浏览

php - Alleged Re-Declaration of function in PHP

I'm getting a PHP fatal error:

Fatal error: Cannot redeclare getString() (previously declared in path/src/scripts/php/functions.php:66) in path/src/scripts/php/functions.php on line 111

These files are included:

  1. index.php which "is" the page
  2. functions.php which is called by index.php via require_once. It includes all the functions and stuff
  3. error.php which is called by functions.php when an error in the given function appears. error.php calls functions.php, but only via require_once, so in this case it should not call the functions.php a second time

I usually know what that error means. But this function is only declared once. Also, the error only occurs when I call it in another function within the functions.php.

Here is the function:

It works, when I call it in index.php like this:

But it doesn't work, when I call the function from within another function in functions.php like this:

There is nothing wrong with the function calling getString(), because when I replace it with hardcoded text, it works.


EDIT

I "solved" the fatal error by removing the code that calls the error.php and the exits. However, now, the getString() function still doesn't function properly. Calling it directly from the index.php (like above) works fine, but calling it within another function leads to no output at all.

0 投票
0 回答
32 浏览

arrays - 升级Web应用程序IE9浏览器时出现多个错误

升级 Web 应用程序 IE9 浏览器时出现多个错误:

我们有从 1.7.1 版升级到 2.1.0 版的外部应用程序。在这个外部表单中,我们有 iframe,我们的应用程序屏幕在其中加载,我们的应用程序正在使用 jquery-1.8.3.js。

任何人都可以帮助我们解决这个问题,为什么我们在升级到 IE9 时遇到上述问题。上述相同的应用程序在 IE11 浏览器上运行绝对正确。

0 投票
2 回答
23937 浏览

model - Laravel 5.0,无法重新声明类 App\models\Category

我最近将我的项目从 laravel 4.2 升级到 laravel 5.0 并且遇到了几个错误。

我没有在 4.2 版本中定义任何命名空间,但正如这里所建议的,

我已经开始在我的代码中定义命名空间。我不知道我面临的问题是否与此有关,但它发生在此过程的中间。

运行代码时出现以下错误:

这是我的 Category.php:

我在 SO 上搜索了类似的错误,但没有找到。

这是我的控制器中在“/”路由上调用的函数。

如果您需要代码中的其他内容,请告诉我。我一直试图找出解决方案已经有一段时间了。

0 投票
1 回答
423 浏览

c++ - struct和int之间的clang重新定义不一致

以下程序在使用 clang 编译时不会出错:

让我们使用 int 代替 struct,然后我们得到:

该程序在使用 clang 编译时会出现重新定义错误。

程序之间的唯一区别是使用的实体类型(struct 或 int),但一个编译没有错误,另一个给出重新定义错误。

这是否表明clang中的错误?当涉及到 using-declarations 时,也许标准是模棱两可的。但是编译器不应该始终如一地解释它吗?

程序可以在这里编译:

0 投票
3 回答
1213 浏览

c - 循环中和循环外的c中的变量重新声明?

int i;在程序中声明语句 2 次时,它会显示错误,但是当int i;在运行两次的 for 循环中编写时,它不会显示任何错误。

0 投票
4 回答
12107 浏览

c++ - 如何解决编译器枚举重声明冲突

考虑以下 C++ 枚举:

编译器使这两个项目发生冲突UNKNOWN并引发此错误:

错误:重新声明“未知”

我能够解决此错误,将其中一个更改UNKNOWNUNKNOWN_a,但我不想更改名称。

如何在更改enum项目名称的情况下解决此冲突?

0 投票
1 回答
284 浏览

javascript - 在循环中重新定义变量不会使其未定义

具有以下for循环:

我期望输出是:

但实际上,输出是:

既然我们使用var p(to redeclare p) 下一行,为什么行中没有pundefined (always) console.log