C++ – Eclipse CDT Indigo CLOCKS_PER_SEC could not be resolved issue

ceclipse-cdt

I dont know if this is a bug or i am the only one facing this,

In Eclipse CDT indigo, create a new C++ executable project and create a CPP file in a C++ source folder.i.e. src/test.cpp

#include<iostream>
#include<ctime>
using namespace std;
int main()
{
    clock_t strt = clock();
    int i = 2;
    clock_t end = clock();
    cout<<(end-strt)*1000.0f/CLOCKS_PER_SEC;
    return 0;
}

now see that the CLOCKS_PER_SEC is unresolved, but project compiles sucessfully and runs fine too. I am on ubuntu 10.10 64 bit. Is this a bug or some settings screw up ( indexer? ) ?

Best Answer

You can manually add the time.h to the indexer, go to Preferences -> C/C++ -> Indexer and put it in front of the existing "Files to be indexed up-front" like this:

time.h, cstdarg, ...

Then it should work just fine.