简体   繁体   English

Xcode 3 gcc 4.2错误:在此范围内未声明“ min”

[英]Xcode 3 gcc 4.2 error: 'min' was not declared in this scope

for some reason now and again xcode/gcc4.2 complains about 由于某种原因,xcode / gcc4.2反复抱怨

error: 'min' was not declared in this scope 

and the same for max 和最大相同

it seems to happen totally randomly, even if i #define them my self at a top level 即使我#在最高级别定义我的自我,它似乎完全是随机发生的

any ideas? 有任何想法吗?

edit. 编辑。 i think this may have started happening after i installed Xcode 4, but not sure 我认为这可能是在我安装Xcode 4之后开始发生的,但不确定

(it may help to specify the language you're using...) (这可能有助于指定您使用的语言...)

what you see could be a few things. 您看到的可能是几件事。 if you are expecting this to be c++'s std::min , then you probably have a rogue using namespace std; 如果您期望这是c ++的std::min ,那么您可能会using namespace std;流氓using namespace std; declared in the global namespace, which is not included ahead of every file. 在全局名称空间中声明,而不是在每个文件之前包含。

if this is the case: 如果是这样的话:

1) delete every global using namespace std declaration (optional, but worthwhile). 1) using namespace std声明(可选,但值得)删除每个全局变量。

2) and/or qualify min with std::min 2)和/或限定minstd::min

This sounds like you are accessing the math.h libraries or something is wrong with your install. 听起来您正在访问math.h库,或者您的安装有问题。 I'd be inclined to suggest removing xcode completely including all developer tools. 我倾向于建议完全删除xcode,包括所有开发人员工具。 The read me's have instructions for doing this. 自述文件中有执行此操作的说明。 Then reboot your machine and reinstall again. 然后重新启动计算机,然后重新安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM