Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse CDT Indigo CLOCKS_PER_SEC could not be resolved issue

Tags:

c++

c

eclipse-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? ) ?

like image 445
FUD Avatar asked Sep 19 '11 19:09

FUD


1 Answers

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.

like image 147
Rob Avatar answered Sep 25 '22 15:09

Rob