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 269010 - splitted source files not recognized for code assistance
Summary: splitted source files not recognized for code assistance
Status: REOPENED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-16 20:44 UTC by ronny123
Modified: 2017-03-31 18:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project example (1.11 KB, application/x-download)
2016-11-17 12:36 UTC, Alexander Simon
Details
test project to reproduce this bug (1.13 KB, application/octet-stream)
2016-11-17 17:18 UTC, ronny123
Details
Thread dump: hung "Clean" action (30.02 KB, text/plain)
2016-11-18 13:11 UTC, ilia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ronny123 2016-11-16 20:44:47 UTC
I have created a project from existing source with makefile.
I have splitted most of my source files in multiple files like this:

main.cpp
--------
 include main.h
 include source1.cpp ( following files can't be compiled standalone)
 include source2.cpp
 ...

In the makefile only main.cpp is compiled, means only one object file is generated.

Code assistence works for main.cpp but not for source1(2).cpp
I have tried all options in menu "configure code assistance"

Same problem exists when header files include additional header files.
For example I have separated template definitions in an additional header file, included in main.h
Comment 1 Alexander Simon 2016-11-17 12:36:29 UTC
Created attachment 162939 [details]
Project example

Attempt to reproduce the bug
Comment 2 Alexander Simon 2016-11-17 12:39:01 UTC
I cannot reproduce a bug. See my example.
Please provide steps to reproduce a bug and reopen the bug.
Comment 3 ronny123 2016-11-17 16:50:11 UTC
ok have tried a small test project by myself and it works.
I will steady increase complexity in order to find out what causes the problem.

Thanks so far
Comment 4 ronny123 2016-11-17 17:18:10 UTC
Created attachment 162940 [details]
test project to reproduce this bug
Comment 5 ronny123 2016-11-17 17:18:30 UTC
ok the problem happens when using namespaces.

the test method of base.cpp provide code assistance when accessing helper.flag1

the test2 method defined in helper.cpp doesn't provide code assistance for member helper.flag1, test2 method isn't recognized either

the problem seems to be that namespace tag is seted in base.cpp around the included helper.cpp

I provide the zipped test project.
In Netbeans IDE I have defined following project properties after creating project from existing source.

Run / Run directory: out
Code Assitance / C++ Standard -> C++11 

by the way: have tried all options (executable, log files) for code assistance analyzer.

Thanks in advence
Comment 6 Alexander Simon 2016-11-17 21:22:20 UTC
Thanks for test project.
I see a problem.
At first the project was configured right (al least on Linux).
Code assistance in "helper.cpp" works (see not empty navigator and breadcrumbs).
But resolver does not properly work:
- helper and flag1 are not resolved (there is no hyper link).
- code audit "Method Declaration is Missed"show false warning.
Comment 7 ilia 2016-11-18 12:22:43 UTC
Alexander, 

Tried to create Project from Existing sources
Automatic configuration

Clean doesn't finish.
Comment 8 ilia 2016-11-18 13:11:35 UTC
Created attachment 162952 [details]
Thread dump: hung "Clean" action
Comment 9 ilia 2016-11-18 13:20:24 UTC
Two comments above are unrelated to this bug, sorry.
Filed a new bug https://netbeans.org/bugzilla/show_bug.cgi?id=269031
Comment 10 ilia 2016-12-05 15:37:33 UTC
ronny123,

Can you please check that your Makefile works on Windows?
For example, I'm running "make -f Makefile clean" from command line on Windows and "Clean" process hangs in a new cmd.exe subshell.

The behavior is same when invoking a clean action from NetBeans.
Comment 11 ronny123 2016-12-05 17:32:44 UTC
hard to say, try to remove

SHELL := cmd (don't know why I have added this, i think to build without ide)
or 
-@$(call delete,out/$(name)*) (maybe there is some problem with the wildcard)

successfull build overwrites binary


ifeq ($(platform),windows)
    SHELL := cmd
    delete = del $(subst /,\,$1)
    copy = xcopy /I /Y $(subst /,\,$1) $(subst /,\,$2)
else
    delete = rm -rf $1
    copy = rm -rf $2 && cp -r $1 $2
endif

clean:
	-@$(call delete,obj/*.o)
	-@$(call delete,out/$(name)*)
Comment 12 ilia 2016-12-05 18:51:49 UTC
> try to remove SHELL := cmd

Running make after that:
-----------------
make: del: Command not found
make: [Makefile:107: clean] Error 127 (ignored)
/bin/sh: del: command not found
make: [Makefile:108: clean] Error 127 (ignored)
-----------------

Running make in /bin/sh shell rather than in cmd.exe doesn't allow to use Windows-specific commands, obviously.

I figured out that there should be a line ".SHELLFLAGS=/C" in the beginning of the Makefile. Otherwise cmd.exe just keeps it's subshell alive.

That has nothing related to the cause of this bug, just an issue I faced trying to reproduce the bug :-)
Comment 13 ronny123 2016-12-05 19:21:05 UTC
you are right, removing SHELL := cmd gives me the same errors.

I have switched from Code::Blocks to Netbeans. That line wasn't needed there. It seems Code::Blocks use cmd for Windows inherently.
The "Clean" process is working for me without hanging in Netbeans or directly from command line.