error: redeclaration of ‘i’ with no linkage for(int i = 0 ;i< COUNT; i++) ^
时间: 2023-06-17 19:02:07 浏览: 1011
这个错误意味着您在同一作用域中多次声明了变量“i”,但没有指定链接。这通常是因为您在同一个函数或全局作用域中声明了两个具有相同名称的变量,导致编译器无法区分它们。
要解决这个错误,您可以尝试以下几个步骤:
1. 确保您在同一作用域中只声明了一个变量“i”。如果您需要在同一作用域中使用多个变量,请为它们指定不同的名称。
2. 如果您确实需要在同一作用域中声明多个名称相同的变量,请为它们指定不同的链接。例如,可以使用关键字“static”或“extern”来指定静态或外部链接。
3. 如果您使用的是C++,您可以考虑使用命名空间来避免命名冲突。
希望这些提示能帮助您解决这个问题。
相关问题
[Error] redeclaration of 'i' with no linkage是什么意思
这个错误提示意味着在同一作用域内多次声明了一个变量或函数。通常情况下,每个变量或函数只能在其作用域内被声明一次。如果你在同一作用域内多次声明一个变量或函数,编译器就会抛出这个错误。这个错误提示还可能意味着你在不同的源文件中使用了同样的全局变量或函数名,这也会导致链接时出错。要解决这个错误,你可以删除重复的声明或将其移动到正确的作用域内。
redeclaration of"i"with no linkage
As an AI language model, I can explain that a redeclaration of "i" with no linkage refers to creating a new variable or object called "i" within a specific scope that has no connection or access to any other "i" variables or objects outside of that scope. This means that any changes or modifications made to this specific "i" will not affect any other "i" variables or objects in other scopes.