在 Eclipse ubuntu 中无法解析 std::string

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10652750/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:11:38  来源:igfitidea点击:

std::string could not be resolved in eclipse ubuntu

c++eclipseincludestdinclude-path

提问by Yonatan Nir

I've tried searching the problem and even saw a similar question in:

我试过搜索问题,甚至在以下位置看到了类似的问题:

"string could not resolved" error in Eclipse for C++ (Eclipse can't resolve standard library)

Eclipse for C++ 中的“字符串无法解析”错误(Eclipse 无法解析标准库)

but his solution of installing mingw did not work. (what is msys? aptitude didn't find any package with that name)

但是他安装mingw的解决方案不起作用。(什么是 msys?aptitude 没有找到任何具有该名称的软件包)

so I get an error message of the std::string problem even though there is an #include which Eclipse does recognize. I've put /usr/include/c++/4.6.3 in the includes of GNU c++ but the problem was not solved... what else can I do?

因此,即使存在 Eclipse 识别的 #include,我也会收到 std::string 问题的错误消息。我已经将 /usr/include/c++/4.6.3 放在 GNU c++ 的包含中,但问题没有解决......我还能做什么?

the code is simple:

代码很简单:

#include<string> 
. 
. 
std::string var;

and the error i get is: "type std::string could not be resolved"

我得到的错误是:“类型 std::string 无法解析”

the code is made up from a lot of classes so i can't paste it all. I've added everything to eclipse from an existing project. I've got the same problem with uint_32t and uint_64t which are not resolved

代码由很多类组成,所以我不能全部粘贴。我已将现有项目中的所有内容添加到 eclipse 中。我对 uint_32t 和 uint_64t 有同样的问题,但没有解决

ANSWER: I solved the issue. Since i created a new project from an existing project, then it just didn't add anything to the include directories so i created a new empty project and just included everything which was included there and it solved it

回答:我解决了这个问题。因为我从现有项目创建了一个新项目,所以它没有向包含目录添加任何内容,所以我创建了一个新的空项目,只包含了包含在那里的所有内容并解决了它

回答by slybloty

Clean up the project and close it and reopen it. Restart Eclipse. Even close Eclipse completely and kill all the processes related to it. Eclipse has done this to me a few times and restarting has worked.

清理项目并关闭它并重新打开它。重新启动 Eclipse。甚至完全关闭 Eclipse 并杀死与之相关的所有进程。Eclipse 已经对我做过几次了,重启成功了。

回答by amanda

you can try use "" instead of <> in include. also you can change string with iostream (#include "iostream") which contains string

您可以尝试在 include 中使用 "" 而不是 <> 。您也可以使用包含字符串的 iostream (#include "iostream") 更改字符串

回答by Yonatan Nir

I solved the issue and it was not that trivial as I thought.

我解决了这个问题,并没有我想象的那么简单。

Since i created a new project from an existing project, then it just didn't add anything to the include directories. Linux/Eclipse is so messed up that it can't even add folders recursively?

由于我从现有项目创建了一个新项目,因此它没有向包含目录添加任何内容。Linux/Eclipse 乱七八糟,连文件夹都不能递归添加?

I just created a new empty project and copied what I needed and was done with it.

我刚刚创建了一个新的空项目并复制了我需要的内容并完成了它。