Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352283

Summary: False error message: Symbol 'CLOCKS_PER_SEC' could not be resolved
Product: [Tools] CDT Reporter: oliremez
Component: cdt-indexerAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: minor    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 197989    
Bug Blocks:    
Attachments:
Description Flags
The PArrser Log File none

Description oliremez CLA 2011-07-17 04:51:25 EDT
Build Identifier: 20110615-0604

The Editor shows the error Symbol 'CLOCKS_PER_SEC' could not be resolved
However, the required header file <ctime> is available and the code can be compiled without problems. 

Reproducible: Always

Steps to Reproduce:
Create following document and execute

#include <ctime>
int main( void )
{
	double foo = 3.1415 / CLOCKS_PER_SEC;
	return 0;
}
Comment 1 Markus Schorn CLA 2011-07-27 07:40:22 EDT
* Please create a parser log for the test file (Context menu of file in project explorer - Index - Create parser log). 
* Also, try to find the header file that defines CLOCKS_PER_SEC and attach it to the bug.
* Check the project setting 'C/C++ General - Index - Files to index up-front', what does it contain?
Comment 2 Markus Schorn CLA 2011-08-19 05:35:20 EDT
No response from submitter.
Comment 3 Sergei Vlasov CLA 2011-09-02 12:03:39 EDT
(In reply to comment #2)
> No response from submitter.

Had the like problem.
Created the sample project above, compiled it. Yes, same errors.

-- added correct #include path to the project
   project->options->paths->includes->GnuC->include directories.
   (J:\cygwin\usr\include   in my case)

Now this compiles correctly.

/** "the like problem" means that I had to change
   #include <ctime>
to
   #include <time.h>
because there was no ctime.h in my cygwin.
Also the 
   #include <time> 
did not work. **/



-- returned to my project (closed the sample project), 
added the same path as above, to it.

Everything works. (Indigo/Cygwin)
Seems this was not a bug.
Comment 4 Kostas CLA 2011-12-15 06:01:07 EST
Created attachment 208429 [details]
The PArrser Log File
Comment 5 Kostas CLA 2011-12-15 06:06:48 EST
Comment on attachment 208429 [details]
The PArrser Log File

Including <ctime> or time.h 

Does not fix the problem. The definition is reported missing but the code compiles normally.
Comment 6 Kostas CLA 2011-12-15 06:08:48 EST
Comment on attachment 208429 [details]
The PArrser Log File

Eclipse Platform

Version: 3.7.1
Build id: R3_7_1
Comment 7 Markus Schorn CLA 2011-12-22 03:54:13 EST
I can reproduce the issue using gcc 4.6.2 on a linux host. It is fixed by what we have done for bug 197989.