Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse signals an error but the code compiles

I'm writing some C++ code with eclipe.

I have a strange behavior with vector objects.

When I use the method resize for example, Eclipse returns the following error:

#include "vector"

   ...

   vector<int> a;
   a.resize(5);

   Error: Invalid arguments candidates are: void resize(?, int).

However the code compiles from command line.

How can I fix this fastidious behavior of eclipse?

like image 993
Maverik Avatar asked Feb 12 '13 15:02

Maverik


1 Answers

After quite a while searching and tinkering with settings, I think I have found an answer. To get the indexer parsing the code correctly I had to:

  1. Right click the project -> Properties
  2. Go to C/C++ General -> Preprocessor Include Paths, Macros etc.
  3. Click the providers tab
  4. Check the CDT GCC Build-in Compiler Settings option
  5. Apply
  6. Rebuild index
like image 196
Lee Netherton Avatar answered Sep 23 '22 10:09

Lee Netherton