This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 221537 - Parser: "cannot open include file" or "type not recognized" in bigger projects
Summary: Parser: "cannot open include file" or "type not recognized" in bigger projects
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.3
Hardware: PC Windows XP
: P2 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
: 223603 (view as bug list)
Depends on: 221835 221758 222800
Blocks:
  Show dependency tree
 
Reported: 2012-11-06 09:18 UTC by mariusz_m
Modified: 2012-12-10 14:25 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
unrecognized types when editing code, back to work after reparsing project (35.30 KB, image/png)
2012-11-06 09:18 UTC, mariusz_m
Details
local definer variable unresolved (51.32 KB, image/png)
2012-11-08 09:38 UTC, mariusz_m
Details
unresolved include file (50.07 KB, image/png)
2012-11-08 09:39 UTC, mariusz_m
Details
project config (125.07 KB, text/html)
2012-11-08 13:13 UTC, mariusz_m
Details
Dump of CodeAssistant c++ code model diagnostics (280.69 KB, application/x-zip)
2012-11-12 13:12 UTC, mariusz_m
Details
enum attribute error (27.36 KB, image/png)
2012-11-12 17:33 UTC, mariusz_m
Details
Dump of CodeAssistant c++ code model diagnostics + xRef (446.62 KB, application/x-zip)
2012-11-13 08:21 UTC, mariusz_m
Details
Parser is not recognizing structure initializator with unions (93.67 KB, application/zip)
2012-11-16 08:42 UTC, mariusz_m
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mariusz_m 2012-11-06 09:18:29 UTC
Created attachment 127196 [details]
unrecognized types when editing code, back to work after reparsing project

It is common that NB 7.2 has problems with bigger project (> 100 files + MinGW includes + wxWidgets includes) and code parser fails to find include files, functions or types - see the picture.
It happens during code editing, and in most cases it back to work after a while. 
When its not, running command "Code Assistance->C++ Reparse Project" will help. But sometimes the only way is to restart NB.
Maybe there are some parser settings that could help with this?
Comment 1 mariusz_m 2012-11-06 09:28:27 UTC
Product Version = NetBeans IDE 7.2 (Build 201207171143)
Operating System = Windows XP version 5.1 running on x86
Same on Win7 x64
Java; VM; Vendor = 1.6.0_31
Runtime = Java HotSpot(TM) Client VM 20.6-b01
Comment 2 Leonid Lenyashin 2012-11-06 14:04:49 UTC
The reason here is certainly not the project size. We have test projects with thousands of files. The information provided isn't enough to diagnose the issue.

The bad thing is that some of the includes are not found. All the rest is secondary. There could be a few reasons for that. So we need to know:
1) the way how the project was created
2) the include search path (hovering over a highlighted include directive hold the Ctrl key to see that). Check if it is correct and put this information here if possible
3) Try to [backup and] remove your userdir and check if problem persists
4) Please try 7.3 Beta or nightly builds because a few similar issues were fixed after 7.2 release time.

Please let us know about your findings.
Comment 3 mariusz_m 2012-11-07 12:52:53 UTC
Probably You are right - the number of files doesn't matter. Now working on smaller embedded project and again parser lost some of include files (main structure is recognized, but it's field defined in another header file is not).
Now it happed during debugging session.
At this moment i did the automatic update. Latest builds? The behavior I described is present since I'm using NB6.8
Now the includes:

Code Assistance
C:\CodeSourceryG++Lite\lib\gcc\arm-none-eabi\4.5.2\include
C:\CodeSourceryG++Lite\lib\gcc\arm-none-eabi\4.5.2\include-fixed
C:\CodeSourceryG++Lite\arm-none-eabi\include
C:\CodeSourceryG++Lite\arm-none-eabi\include\c++\4.5.2
C:\CodeSourceryG++Lite\arm-none-eabi\include\c++\4.5.2\arm-none-eabi
C:\CodeSourceryG++Lite\arm-none-eabi\include\c++\4.5.2\backward
C:\CodeSourceryG++Lite\lib\gcc\arm-none-eabi\4.5.2\include
C:\CodeSourceryG++Lite\lib\gcc\arm-none-eabi\4.5.2\include-fixed
C:\CodeSourceryG++Lite\arm-none-eabi\include

Hovering Ctrl+Alt over include file name: (all are black, not red, so the paths are correct)
---
File D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\common\trace.h From project _projname_
Analyzed user include paths:
D:\Dokumenty\Projekty\_projname_\gui\src
D:\Dokumenty\Projekty\_projname_\gui\src\newlib
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\common
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\platform
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\egol\controls
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\egol\drawer
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\egol\gl
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\egol\project
D:\Dokumenty\Projekty\_projname_\gui\src\egol\include\egol\system
D:\Dokumenty\Projekty\_projname_\gui\src\egol\platform
D:\Dokumenty\Projekty\_projname_\gui\src\csp
D:\Dokumenty\Projekty\_projname_\gui\src\csp\cmsis
D:\Dokumenty\Projekty\_projname_\gui\src\csp\mcu
D:\Dokumenty\Projekty\_projname_\gui\src\etius
D:\Dokumenty\Projekty\_projname_\gui\src\bsp_grinn
Analyzed system include paths:
C:\CodeSourceryG++Lite\arm-none-eabi\include\c++\4.5.2
C:\CodeSourceryG++Lite\arm-none-eabi\include\c++\4.5.2\arm-none-eabi
C:\CodeSourceryG++Lite\arm-none-eabi\include\c++\4.5.2\backward
C:\CodeSourceryG++Lite\lib\gcc\arm-none-eabi\4.5.2\include
C:\CodeSourceryG++Lite\lib\gcc\arm-none-eabi\4.5.2\include-fixed
C:\CodeSourceryG++Lite\arm-none-eabi\include
Ctrl+Alt+Click to open include hierarchy
---

The unresolved identifier is from 'src' path. Yesterday the editor highlighted some of the include directives, but today did not. I can click and navigate through the includes, but not the unresolved fields. However, I can navigate from file where the structure with 'unresolved' field is defined. So the problem is local to some opened file, not the whole project.
Now, running "Reparse project" fix everything. For an hour, or for a couple of minutes. BTW i'm wondering why this command was removed from the MPLAB X?

You are asking the way the project was created - the first one from the creator, C++ Application. The next one is modification of previous. I was looking into the project file for some invalid definitions or include paths, but it's clear - everything is like expected when looking at the project tree files, includes and so on.
Comment 4 mariusz_m 2012-11-07 12:57:31 UTC
Again! I'm debugging the code, and editor highlighted all the include directives in current file.
But now the paths are:
---
Unresolved directive #include "gol_frame.h" 
Analyzed system include paths:
C:\MinGW\lib\gcc\mingw32\4.6.1\include\c++
C:\MinGW\lib\gcc\mingw32\4.6.1\include\c++\mingw32
C:\MinGW\lib\gcc\mingw32\4.6.1\include\c++\backward
C:\MinGW\lib\gcc\mingw32\4.6.1\include
C:\MinGW\include
C:\MinGW\lib\gcc\mingw32\4.6.1\include-fixed
Ctrl+Alt+Click to open include hierarchy
---

What I'm seeing is the parser looks for different toolchain than expected!
And none of project specific includes are visible here.
Comment 5 Leonid Lenyashin 2012-11-07 14:37:20 UTC
Can you please try 7.2 or 7.3 beta. Lots of fixes in this are were done since 6.8! The issue is most likely fixed there. Please confirm.
Comment 6 mariusz_m 2012-11-07 16:07:26 UTC
No no no, I'm using 7.2 - take a look at the second comment :)
My intention was to say this issue is not a new one.
I'll try 7.3 beta as you suggest.
Comment 7 Leonid Lenyashin 2012-11-07 18:01:46 UTC
Misinterpreted user's comment on version.
Managed project, include paths get screwed for some reason.
Comment 8 mariusz_m 2012-11-08 09:38:17 UTC
Created attachment 127369 [details]
local definer variable unresolved
Comment 9 mariusz_m 2012-11-08 09:39:40 UTC
Created attachment 127370 [details]
unresolved include file
Comment 10 mariusz_m 2012-11-08 09:42:40 UTC
BTW i cannot download 7.3beta - the file server hangs time after time, after downloaded 43MB :(
http://dlc.sun.com.edgesuite.net/netbeans/7.3/beta/bundles/netbeans-7.3beta-cpp-windows.exe
Comment 11 mariusz_m 2012-11-08 11:01:19 UTC
(In reply to comment #10)
> BTW i cannot download 7.3beta - the file server hangs time after time, after
> downloaded 43MB :(
> http://dlc.sun.com.edgesuite.net/netbeans/7.3/beta/bundles/netbeans-7.3beta-cpp-windows.exe

Download finished. Doesn't matter anymore.
Comment 12 Alexander Simon 2012-11-08 11:15:06 UTC
(In reply to comment #9)
> Created attachment 127370 [details]
> unresolved include file
What is a properties of file callbasks.cpp?
I'm interesting of include paths and macros.
What is output of command:
#wx-config --cxxflags
Comment 13 mariusz_m 2012-11-08 12:35:31 UTC
The properties all global to all file projects, no exception.
It's not specific file dependent.
It's not project dependent (MinGW+wx or SourceryG++ for ARM).
It's not compiler dependent.
It's not additional includes and library (like wx) dependent.

Parser sometimes go mad, although the project compiles and build correctly with 0 warnings. 

Currently I'm testing 7.3b, who knows, maybe the problem is already fixed...
Comment 14 Alexander Simon 2012-11-08 12:43:38 UTC
Please, provide compile line of file callbasks.cpp (from build log)
Comment 15 mariusz_m 2012-11-08 13:06:39 UTC
7.2

CLEAN SUCCESSFUL (total time: 313ms)

mkdir -p build/Dbg_Designer/MinGW-Windows/designer
rm -f build/Dbg_Designer/MinGW-Windows/designer/callbacks.o.d
g++.exe -O0 -g2 -Wall -Wshadow -Winit-self -Wredundant-decls -Wunreachable-code -Wno-ctor-dtor-privacy -gstabs -Winline   -c -g -DCHECK_MEMORY_OVERWRITE -DEGOL_HMI=1 -DHAVE_W32API_H -DNDEBUG -DNOPCH -DWINVER=0x0500 -D__WXMSW__ -I/C/wxWidgets/include/ -I/C/wxWidgets/lib/gcc_lib/msw -I/C/wxWidgets/additions/include -Ivfs/src -Ivfs/src/elm_fat -Ivfs/src/elm_fat/option -Inewlib -Idesigner -Iinclude/common -Iinclude/egol/controls -Iinclude/egol/drawer -Iinclude/egol/gl -Iinclude/egol/project -Iinclude/egol/system -Iinclude/egol/hmi -Iinclude/platform -Iegol/expat-2.0.1/lib -Iegol/project -Iegol/drawer/basic -Iplatform/generic -Iplatform/win32 -Idesigner/ctb/include -Iinclude/lua -MMD -MP -MF build/Dbg_Designer/MinGW-Windows/designer/callbacks.o.d -o build/Dbg_Designer/MinGW-Windows/designer/callbacks.o designer/callbacks.cpp


BUILD SUCCESSFUL (total time: 12s)

-----------

7.3b

CLEAN SUCCESSFUL (total time: 359ms)

mkdir -p build/Dbg_Designer/MinGW-Windows/designer
rm -f build/Dbg_Designer/MinGW-Windows/designer/callbacks.o.d
g++.exe -O0 -g2 -Wall -Wshadow -Winit-self -Wredundant-decls -Wunreachable-code -Wno-ctor-dtor-privacy -gstabs -Winline   -c -g -DCHECK_MEMORY_OVERWRITE -DEGOL_HMI=1 -DHAVE_W32API_H -DNDEBUG -DNOPCH -DWINVER=0x0500 -D__WXMSW__ -I/C/wxWidgets/include/ -I/C/wxWidgets/lib/gcc_lib/msw -I/C/wxWidgets/additions/include -Ivfs/src -Ivfs/src/elm_fat -Ivfs/src/elm_fat/option -Inewlib -Idesigner -Iinclude/common -Iinclude/egol/controls -Iinclude/egol/drawer -Iinclude/egol/gl -Iinclude/egol/project -Iinclude/egol/system -Iinclude/egol/hmi -Iinclude/platform -Iegol/expat-2.0.1/lib -Iegol/project -Iegol/drawer/basic -Iplatform/generic -Iplatform/win32 -Idesigner/ctb/include -Iinclude/lua -O0 -g2 -Wall -Wshadow -Winit-self -Wredundant-decls -Wunreachable-code -Wno-ctor-dtor-privacy -gstabs -Winline -MMD -MP -MF build/Dbg_Designer/MinGW-Windows/designer/callbacks.o.d -o build/Dbg_Designer/MinGW-Windows/designer/callbacks.o designer/callbacks.cpp


BUILD SUCCESSFUL (total time: 11s)

I see some differences between these two versions (some arguments are repeated in 7.3)
Comment 16 mariusz_m 2012-11-08 13:13:18 UTC
Created attachment 127398 [details]
project config
Comment 17 Alexander Simon 2012-11-08 13:44:53 UTC
(In reply to comment #16)
> Created attachment 127398 [details]
> project config
I do not understand what is a file.
Please attach nbproject/configurations.xml
Comment 18 mariusz_m 2012-11-08 14:41:50 UTC
(In reply to comment #17)
> (In reply to comment #16)
> > Created attachment 127398 [details]
> > project config
> I do not understand what is a file.
> Please attach nbproject/configurations.xml

It is configurations.xml!
Click on [details] and you will see xml data.
Comment 19 mariusz_m 2012-11-08 17:35:15 UTC
In 7.3b the problem still exists.
After delete unused #include, parser was started and many of local variables has been marked as unresolved
Comment 20 mariusz_m 2012-11-08 17:57:52 UTC
Moreover, now the breakpoints are not working. My executable was 48MB, now it's 28MB (linker commandline differs from previous (comment15) - some debugger data is missing?)
Comment 21 mariusz_m 2012-11-12 13:12:08 UTC
Created attachment 127619 [details]
Dump of CodeAssistant c++ code model diagnostics
Comment 22 mariusz_m 2012-11-12 13:15:51 UTC
The first dump was created when parser error occurred, the second is after command "reparse project"
You can compare these files, maybe you find something useful.
BTW the dumps are from NB7.2
Comment 23 Alexander Simon 2012-11-12 14:41:05 UTC
(In reply to comment #22)
> The first dump was created when parser error occurred, the second is after
> command "reparse project"
> You can compare these files, maybe you find something useful.
> BTW the dumps are from NB7.2

Thanks for dump.
To understand what is happened we need "Cache of xRef for file" (last check box of C/C++ diagnostics)
Comment 24 mariusz_m 2012-11-12 17:33:37 UTC
Created attachment 127654 [details]
enum attribute error

Meanwhile, I'v found something interesting. The attributes for struct and union are recognized correct (may be specified before '{' or just after '}', but for enum only one position is accepted (after closing bracket)

The macro is defined as follows:
#ifdef __GNUC__
	#define ATTR_PACKED 			__attribute__ ((packed))
#else
...
#endif

I will prepare new, extended dump as soon as possible.
Comment 25 mariusz_m 2012-11-13 08:21:20 UTC
Created attachment 127681 [details]
Dump of CodeAssistant c++ code model diagnostics + xRef
Comment 26 Quality Engineering 2012-11-14 02:42:32 UTC
Integrated into 'main-golden', will be available in build *201211140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1a9468fa0627
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #221537 Parser: "cannot open include file" or "type not recognized" in bigger projects
- make references cache keys a token based
Comment 27 Quality Engineering 2012-11-15 02:45:17 UTC
Integrated into 'main-golden', will be available in build *201211150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f224d6467a38
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #221537 Parser: "cannot open include file" or "type not recognized" in bigger projects
- fix concurrent modification exception
Comment 28 mariusz_m 2012-11-16 08:42:51 UTC
Created attachment 127913 [details]
Parser is not recognizing structure initializator with unions

NB7.3beta2
The initialization of structure containing other structures and unions is incorrect.
Snapshot, source file and code model diagnostic dump attached.
Comment 29 Quality Engineering 2012-11-20 02:39:46 UTC
Integrated into 'main-golden', will be available in build *201211200002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2a68a9e9dc75
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #221537 Parser: "cannot open include file" or "type not recognized" in bigger projects
- do not put references of document base file
Comment 30 mariusz_m 2012-11-27 07:26:21 UTC
Latest nightly build:
- main issue - fixed
- comment #24 - not fixed
- comment #28 - not fixed
Comment 31 Alexander Simon 2012-11-27 08:45:11 UTC
(In reply to comment #30)
> Latest nightly build:
> - main issue - fixed
> - comment #24 - not fixed
see separate bug #222800
> - comment #28 - not fixed
Please provide compilable example and file a separate bug.
Comment 32 Vladimir Voskresensky 2012-12-10 14:25:28 UTC
*** Bug 223603 has been marked as a duplicate of this bug. ***