Bug 203946 - KDevelop cannot recognize std::printf, but recognizes ::printf
Summary: KDevelop cannot recognize std::printf, but recognizes ::printf
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (other bugs)
Version First Reported In: git master
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 364636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-15 14:52 UTC by Alexander
Modified: 2016-06-22 17:20 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Screenshot showing error (41.03 KB, image/png)
2016-06-22 17:17 UTC, Damir Porobic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander 2009-08-15 14:52:32 UTC
Version:           SVN (using KDE 4.3.0)
Compiler:          gcc 4.3.2 
OS:                Linux
Installed from:    SuSE RPMs

For some reason, the SVN version of KDevelop (r1011610) + KDevPlatform (r1011577) doesn't recognize the following:

#include <cstdio>
#include <cstdlib>

void f()
{
	std::printf("hello");  // squiggles under std::printf
	std::abort();  // no squiggles here
}

If I change std::printf to printf or ::printf, the squiggles go away.
fprintf, fopen, etc... are also affected. This seems to happen only with cstdio, not with cstdlib or any other headers I've used.

Hovering mouse over <cstdio> shows:

cstdio
path: /usr/include/c++/4.3/cstdio
Included: 6 Included by: 3 Defined macros: 366
Declarations:
Typedef fpos_t, Typedef fpos64_t, Variable stdin, Variable stdout, Variable stderr, Function remove, Function rename, Function renameat, Function tmpfile, Function tmpfile64, Function tmpnam, Function tmpnam_r, Function tempnam, Function fclose, Function fflush, Function fflush_unlocked, Function fcloseall, Function fopen, Function freopen, Function fopen64, Function freopen64, Function fdopen, Function fopencookie, Function fmemopen, Function open_memstream, Function setbuf, Function setvbuf, Function setbuffer, Function setlinebuf, Function fprintf, Function printf, Function sprintf, .... and so on...


Hovering over cstdlib, however, shows:
cstdlib
path: /usr/include/c++/4.3/cstdlib
Included: 3 Included by: 3 Defined macros: 0
Declarations:
std, __gnu_cxx, std, std::div_t, std::ldiv_t, std::abort, std::abs, std::atexit, std::atof, ...

That is, cstdlib shows stuff from std:: namespace, while cstdio shows stdio.h contents.
Comment 1 Alexander 2009-08-15 16:12:34 UTC
Same with <cstdarg> and std::va_list.

Hovering over cstdarg shows:
cstdarg
path: /usr/include/c++/4.3/cstdarg
Included: 0 Included by: 5 Defined macros: 10
Declarations:
Typedef __gnuc_va_list, Typedef va_list
Comment 2 Alexander 2009-10-05 21:40:52 UTC
The problem seems to be gone after removing ~/.kdevduchain.

I still get random squiggles (parts of the standard facilities from a header recognized, other parts not) which are usually resolved by opening the respective standard headers (both C and C++ ones, like stdio.h and cstdio), then pressing F5 on them and the affected file. Probably a different bug? (kinda hard to reproduce).
Comment 3 Hamish Rodda 2010-05-05 12:12:06 UTC
I have tried several ways to reproduce this, including project open or not, new file or not, but have not been successful with kdevelop 4.0.  Please reopen if you are still experiencing this.
Comment 4 smihael 2015-08-14 10:04:58 UTC
Reopen. I'm having the same trouble with KDevelop Version 4.6.0 using KDE Development Platform 4.13.3.

Even though I included
#include <stdio.h> 
#include <string>

I get following "errors" (it compiles fine, just the code completion doesn't work and code hinting gives wrong information)

Problem in Semantic Analysis:
Declaration not found: printf

Problem in Semantic Analysis:
Declaration not found: string::npos

Problem in Semantic Analysis:
Declaration not found: begin

It doesn't matter if I use std namespace directly or by using command.
Comment 5 Damir Porobic 2016-06-22 17:12:29 UTC
*** Bug 364636 has been marked as a duplicate of this bug. ***
Comment 6 Damir Porobic 2016-06-22 17:17:12 UTC
Created attachment 99658 [details]
Screenshot showing error
Comment 7 Damir Porobic 2016-06-22 17:20:35 UTC
Comment on attachment 99658 [details]
Screenshot showing error

Looks like I've got the same or similar error. I'm running KDevelop 4.7.1, KDE Development Platform 4.14.18.

Everything compiles fine but just the editor gives the same error and after opening the header files where the functions are defined and refreshing it was gone.