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

Bug 352539

Summary: fprintf is not resolved
Product: [Tools] CDT Reporter: Gunther Piez <gpiez>
Component: cdt-indexerAssignee: Project Inbox <cdt-indexer-inbox>
Status: RESOLVED INVALID QA Contact: Markus Schorn <mschorn.eclipse>
Severity: major    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
parser log
none
stdio.h none

Description Gunther Piez CLA 2011-07-20 04:01:11 EDT
Build Identifier: 20110615-0604

Neither `fprintf` nor `stdout` from <cstdio> are resolved. This happens using gcc-4.5.3 on Linux.

Reproducible: Always

Steps to Reproduce:
1. Create new hello world c++ project.

2. Change it to:

#include <cstdio>
using namespace std;

int main() {
	fprintf(stdout,"!!!Hello World!!!"); // prints !!!Hello World!!!
	return 0;
}
Comment 1 Markus Schorn CLA 2011-07-27 09:09:52 EDT
Works for me on Windows with either cygwin or mingw.

* 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 stdout 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 Gunther Piez CLA 2011-07-30 04:02:57 EDT
Created attachment 200618 [details]
parser log
Comment 3 Gunther Piez CLA 2011-07-30 04:07:04 EDT
Created attachment 200619 [details]
stdio.h
Comment 4 Gunther Piez CLA 2011-07-30 04:08:32 EDT
The parser.log shows some interesting lines:

Include Search Path (option -I):
   /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4
   /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/x86_64-pc-linux-gnu
   /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/backward
   /usr/local/include
   /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include
   /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include-fixed
   /usr/include
...
Unresolved includes (from headers in index):
   file:/usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/cstdio
is not indexed

The last file does exist and is valid (and it includes stdio.h).
Interesting enough, I can shift-click the include <cstdio> in the source
and open it.

Files to index up-front contains "stdarg.h, stddef.h, sys/types.h".

- Gunther
Comment 5 Gunther Piez CLA 2011-07-30 04:25:49 EDT
After seeing this strange error it occured to me that I should read my system update log. And indeed, an update of the java sdk (to sun-jdk-1.6.0.26) has happened... and indeed, after reverting to the previous version, it works again.

Sorry for the noise, but who would expect that after some minor jdk update eclipse would suddenly loose the ability to read some files.