-1

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)

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

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?

the code is simple:

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

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

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

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

Community
  • 1
  • 1
CodeMonkey
  • 11,196
  • 30
  • 112
  • 203
  • 1
    Could you add some code. Also please paste the exact error you are getting. – Ivaylo Strandjev May 18 '12 at 12:35
  • the code is simple: include . . std::string var; and the error i get is: "type std::string could not be resolved" – CodeMonkey May 18 '12 at 12:37
  • 1
    @YonatanNir: If that's the code, then the errors are obvious. 1) You're missing a hash-mark before your include statement. 2) .. is not a valid C++ expression. 3) You're missing a main function. – Benjamin Lindley May 18 '12 at 12:45
  • 2
    please paste your actual code not only a stub. We should be able to reproduce the problem from it. In your code you even miss the hash'#' before the include. – Ivaylo Strandjev May 18 '12 at 12:46
  • @Benjamin Lindley i just forgot to type the # here but it appears in my code. why would a missing main function cause the compiler to not recognize a type? – CodeMonkey May 18 '12 at 13:06
  • @YonatanNir: Obviously it wouldn't, I was being facetious. My point was stated more explicitly by izomorphius, which was this: "please paste your actual code, not only a stub". – Benjamin Lindley May 18 '12 at 13:09
  • @Benjamin Lindley 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 – CodeMonkey May 18 '12 at 14:01
  • Paste a small code sample that reproduces the error. – juanchopanza May 18 '12 at 14:22
  • @juanchopanza issue solved. the answer is now in the question box – CodeMonkey May 18 '12 at 14:57
  • Go to project properties -> C/C++ build -> Toolchain editor and see if you've chosen your toolchain properly – Vanuan Sep 19 '12 at 09:48

3 Answers3

0

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.

slybloty
  • 6,346
  • 6
  • 49
  • 70
0

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

amanda
  • 394
  • 1
  • 9
0

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?

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

CodeMonkey
  • 11,196
  • 30
  • 112
  • 203