Eclipse CDT Indigo CLOCKS_PER_SEC failed to solve the problem

I don’t know if this is a mistake, or am I the only one who encounters this,

In the Eclipse CDT indigo, create a new executable C ++ project and create a CPP file in the C ++ source folder. ie 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 you will see that CLOCKS_PER_SEC is not resolved, but the compilation of the project is successful and works fine. I'm on ubuntu 10.10 64 bit. Is this an error or some settings freeze (indexer?)?

+5
source share
4 answers

You can manually add time.h to the index, go to Preferences → C / C ++ → Indexer and place it in front of the existing “Files for indexing up” as follows:

time.h, cstdarg, ...

Then it should work fine.

+10

My eclipse behaves exactly the same. I think this is something like an indexer.

0
source

Comment # 17 on this bug report worked for me

Project-> properties-> indexer: "Files to index up"            Put ctime at the top of the list.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=351549

0
source

All Articles