Reputation: 928
How can my program compile successfully but eclipse shows me "Semantic Errors" and how could I get rid of those errors?
The error messages I have are the following
Method 'c_str' could not be resolved
(this happens also for compare and size on strings)
Here an example:
std::string someotherstring = "test";
std::string name = someotherstring.c_str();
The problem here is that it also creates follow up errors which seem all to be not true, my software compiles and runs as intended and even uses the "c_str()
" returns to process messages. It seems only to be a display issue in Eclipse.
I have searched now for hours, tried to use a custom indexer but for some reason it won't go away. Maybe someone else has a good idea what to do here as Google spits out nothing about this specific problem. (I have even tried to use different C++11 standard flags as I thought it might had an impact)
Upvotes: 3
Views: 4144
Reputation: 475
If you're building your projects using mingw and using C++11, you can not use the default dialect option of -std=c++0x.
Click on 'GCC C++ Compiler' and in the Command: textbox, enter -std=gnu++0x after the g++
Upvotes: 1
Reputation: 726
I had the same problem. Solved by simply run a index -> rebuild. You can find that by clicking on the project main folder with the right button. Cheers
Upvotes: 4