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 230018 - Header files grey out
Summary: Header files grey out
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.3
Hardware: PC Windows 8 x64
: P2 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-21 07:01 UTC by bkbogy
Modified: 2013-05-22 02:03 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bkbogy 2013-05-21 07:01:26 UTC
I have 6 header files, 2 of them end up being greyed out between #ifndef and #endif.  Anything outside of that looks normal.  Code functions properly.  Only able to resolve by removing #include statements throughout the program and then re-enter them.  Closing and opening doesn't fix the issue, nor does the restarting of the computer.

Sample header file in question:

#include "Color.h"
#include <string>

using namespace std;

#ifndef _IMAGELOADER_H_
#define	_IMAGELOADER_H_

class ImageLoader
{
public:
    virtual Color** loadimage(string filename)=0;
    virtual void saveimage(string filename, Color** img, int w, int h)=0;
    
    int width;
    int height;
    string datatype;
    unsigned int maxval;
};


#endif
Comment 1 Vladimir Voskresensky 2013-05-21 12:21:58 UTC
It would be great if you can try daily bits just to check if already fixed in trunk. 
http://bits.netbeans.org/dev/nightly/latest/

If reproducible in nightly, could you, please, try to create sample project and attach it here, so I will be able to debug it.

Thanks!
Vladimir.
Comment 2 Vladimir Voskresensky 2013-05-21 12:23:52 UTC
btw, your example of header file is not usual.
In most cases all code is put between
#ifndef _IMAGELOADER_H_
#define    _IMAGELOADER_H_
...
#endif

while you have some code above 
#ifndef _IMAGELOADER_H_

You can try and move 
#ifndef _IMAGELOADER_H_
#define    _IMAGELOADER_H_
to be above all statements (and below copyright text if you have it)
Comment 3 Vladimir Voskresensky 2013-05-21 12:25:11 UTC
Specifically, I propose to change code to be:
-----------
/**
 * Copyright
 */
#ifndef _IMAGELOADER_H_
#define    _IMAGELOADER_H_

#include "Color.h"
#include <string>

using namespace std;

class ImageLoader
{
public:
    virtual Color** loadimage(string filename)=0;
    virtual void saveimage(string filename, Color** img, int w, int h)=0;

    int width;
    int height;
    string datatype;
    unsigned int maxval;
};


#endif
--------
Comment 4 bkbogy 2013-05-21 21:10:57 UTC
(In reply to comment #3)
Hmm, I've been writing code (and was taught to write the code) with #include outside of #ifndef #endif...


> Specifically, I propose to change code to be:
> -----------
> /**
>  * Copyright
>  */
> #ifndef _IMAGELOADER_H_
> #define    _IMAGELOADER_H_
> 
> #include "Color.h"
> #include <string>
> 
> using namespace std;
> 
> class ImageLoader
> {
> public:
>     virtual Color** loadimage(string filename)=0;
>     virtual void saveimage(string filename, Color** img, int w, int h)=0;
> 
>     int width;
>     int height;
>     string datatype;
>     unsigned int maxval;
> };
> 
> 
> #endif
> --------
Comment 5 Leonid Lenyashin 2013-05-21 21:18:02 UTC
(In reply to comment #4)
> It would be great if you can try daily bits just to check if already fixed in
> trunk. 
> http://bits.netbeans.org/dev/nightly/latest/
> 
> If reproducible in nightly, could you, please, try to create sample project and
> attach it here, so I will be able to debug it.
> 
> Thanks!
> Vladimir.
So moving back to incomplete, as there is no sign of check and no project attached.
Comment 6 bkbogy 2013-05-21 21:24:26 UTC
(In reply to comment #3)
By the way, what does that Copyright multi-line comment do?  Is it just to let the others know that it's an intellectual property?

> Specifically, I propose to change code to be:
> -----------
> /**
>  * Copyright
>  */
> #ifndef _IMAGELOADER_H_
> #define    _IMAGELOADER_H_
> 
> #include "Color.h"
> #include <string>
> 
> using namespace std;
> 
> class ImageLoader
> {
> public:
>     virtual Color** loadimage(string filename)=0;
>     virtual void saveimage(string filename, Color** img, int w, int h)=0;
> 
>     int width;
>     int height;
>     string datatype;
>     unsigned int maxval;
> };
> 
> 
> #endif
> --------
Comment 7 bkbogy 2013-05-21 21:36:31 UTC
It appears Vladimir's suggestion of having #include statements inside of header definition fixed the issue.  I don't see a re-occurrence under the same conditions.

Thank you, Vladimir.
Comment 8 bkbogy 2013-05-22 02:00:28 UTC
A follow up:  I've been working on the project all day long and the issue did not re-occur.  Vladimir's solution solved it 100%.

Thank you, sir!