Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 bool Class Members Marked as Undefined
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 16 2014 :  10:02:23 AM  Show Profile  Reply with Quote
Hello,

Working on a very large MFC project in Visual Studio 2008, I find that when I define a bool member variable in a class, references to that member variable in the .cpp file are flagged with an indication that the variable does not exist, and the variable is not included in selection lists when I type a variable name. This does not happen with local bool variables.

I tried creating a new project and adding a bool member variable to one of the classes, but the problem does not happen in that case.

Has anyone else run into this problem? If so, is there a work-around of some type -- perhaps a setting that can be changed to influence this behavior?

Thanks,

Bob

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 16 2014 :  10:20:21 AM  Show Profile  Reply with Quote
Sorry...I forgot to include version info about Visual Assist:

VA_X.dll file version 10.8.2023.0 built 2013.12.20
DevEnv.exe version 9.0.30729.1 Professional
msenv.dll version 9.0.30729.1
Font: Lucida Sans Typewriter 13 (pixels)
Comctl32.dll version 6.10.7601.17514
Windows 7 6.1 Build 7601 Service Pack 1
8 processors (x86-64, WOW64)
Language info: 1252, 0x409

Platform: Win32
Stable Includes:
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\include;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;

Other Includes:

Stable Source Directories:
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfc;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfcm;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\atl;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\crt\\src;

Thanks,

Bob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 16 2014 :  7:24:05 PM  Show Profile  Reply with Quote
Strange, I am not sure why bool member variables are being singled out like this. At a guess there is something in your class declaration that is confusing our parser.

Can you please try going to the file where the class is declared and showing VA Outline. Are the bool member variables shown in VA Outline? If not, are any other members missing? What about the member immediately above the first problem bool? I am wondering if there is a complex macro, or something else, that might be triggering this problem.

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 17 2014 :  08:53:45 AM  Show Profile  Reply with Quote
Hello,

Thank you for the reply.

quote:
Originally posted by feline
Can you please try going to the file where the class is declared and showing VA Outline. Are the bool member variables shown in VA Outline? If not, are any other members missing? What about the member immediately above the first problem bool? I am wondering if there is a complex macro, or something else, that might be triggering this problem.



I looked at the VA Outline window for the header file where the class is declared. The bool variables do appear in the outline. When looking at the header file in the editor, I see that the bool variables are not colorized the same as other variables. I have not seen this behavior with other data types.

The class definition does not include any macros, but the project is very large, so it is possible that there is a macro being included from a project header that is causing problems. When searching through the headers, I did find this typedef:

typedef int bool;


The file containing that typedef is not being explicitly included in the class where the bool issues are going on, but since it is in a file getting parsed into the VA database, perhaps it is causing problems. I tried putting that typedef into a smaller project that does not have this bool issue, and it did not seem to cause any problems.

Cheers,

Bob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 20 2014 :  11:29:23 AM  Show Profile  Reply with Quote
This is a little unexpected. Lets try something else.

If you show VA View, then place keyboard focus back into the editor, and now hover the mouse over the problem class or one of its members, is the correct information displayed in the bottom half of VA View?

Are all of the class members being listed, including the problem bool members?

Can you please look in your VA options, and see if you have:

VA Options -> Advanced -> Listboxes -> Get content from default Intellisense

turned On or Off? Does changing this setting have any effect on this problem?

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 21 2014 :  08:38:07 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

This is a little unexpected. Lets try something else.

If you show VA View, then place keyboard focus back into the editor, and now hover the mouse over the problem class or one of its members, is the correct information displayed in the bottom half of VA View?

Are all of the class members being listed, including the problem bool members?



In VA View, I do not see the bool members. There are a few members that use the MFC BOOL typedef instead of bool, and the BOOL members are in VA View and do not have this problem.

quote:

Can you please look in your VA options, and see if you have:

VA Options -> Advanced -> Listboxes -> Get content from default Intellisense

turned On or Off? Does changing this setting have any effect on this problem?



I had the "Get content from default Intellisense" turned off. I tried turning it on, but it did not make a difference.

Cheers,

Bob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 22 2014 :  9:41:54 PM  Show Profile  Reply with Quote
A very interesting result, which does explain the problem with the listboxes. Now we just need to figure out what is going on here.

Can you please open VA's Find Symbol dialog, turn Off the checkbox "Show only symbols defined in current solution" and then filter the list for the name of the problem class.

Are you seeing more than one class listed, or just the one class with its members? I am just checking to see if a duplicate class name might be a factor here.

If you are only seeing the one class, can you please try placing the caret into one of the working member variables and look at the VA context and definition fields. Now place the caret into one of the problem bool variables and look at the context and definition fields again. Is this offering any useful clues?

What is shown when you place the caret into the type "bool"?

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 23 2014 :  08:25:12 AM  Show Profile  Reply with Quote
Once more into the breach...
quote:
Originally posted by feline
Can you please open VA's Find Symbol dialog, turn Off the checkbox "Show only symbols defined in current solution" and then filter the list for the name of the problem class.

Are you seeing more than one class listed, or just the one class with its members? I am just checking to see if a duplicate class name might be a factor here.


The list contains only one class with the name I used as a filter. I'm not sure I made it clear, but this problem seems to be happening in all of the classes in my solution. I spot-checked five or so other classes in various projects within the solution and saw the same problem. The Find Symbol dialog does not seem to contain any bool member variables (it does include BOOL member variables, and methods that return bool.) It is as if VA thinks bool is not a valid type.
quote:

If you are only seeing the one class, can you please try placing the caret into one of the working member variables and look at the VA context and definition fields. Now place the caret into one of the problem bool variables and look at the context and definition fields again. Is this offering any useful clues?


As indicated above, there are no bool variables in the list. The context and definition info from members with other types seems to be correct.
quote:

What is shown when you place the caret into the type "bool"?


I see nothing, similar to the result when I put the caret over an int or other native type. When I hover the mouse over BOOL, I see "typedef int BOOL", as expected.

Thank you for your continued support.

Cheers,

Bob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 23 2014 :  9:47:04 PM  Show Profile  Reply with Quote
Thank you for that. Duplicate class names was a bit of a long shot, but worth checking on the off chance. A new idea, are the classes you are seeing the problem with derived from anything? Or don't they have parents?

Can you please try adding a new, empty header file to your solution and then place this code into the header file:

struct felineTestVariableTypes
{
	bool m_boolMember;
	const bool m_constBoolMember;
	bool *m_boolPointer;
	const bool *m_constBoolPointer;
	int m_intMember;
};

void felineTestUsingStructMembers()
{
	felineTestVariableTypes felineFoo;
	// type dot after this type
	felineFoo;
};


what do you get with this struct?

Since this is a simple struct, there are no class hierarchy complications, and putting it into an empty header file removes any direct problems from something further up the header file.

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 24 2014 :  08:14:33 AM  Show Profile  Reply with Quote
Hello,

quote:
Originally posted by feline

Thank you for that. Duplicate class names was a bit of a long shot, but worth checking on the off chance. A new idea, are the classes you are seeing the problem with derived from anything? Or don't they have parents?


Some classes are derived and some are not. The solution contains both C and C++ projects.
quote:

Can you please try adding a new, empty header file to your solution and then place this code into the header file:

struct felineTestVariableTypes
{
	bool m_boolMember;
	const bool m_constBoolMember;
	bool *m_boolPointer;
	const bool *m_constBoolPointer;
	int m_intMember;
};

void felineTestUsingStructMembers()
{
	felineTestVariableTypes felineFoo;
	// type dot after this type
	felineFoo;
};


what do you get with this struct?

Since this is a simple struct, there are no class hierarchy complications, and putting it into an empty header file removes any direct problems from something further up the header file.


In the struct definition, m_boolMember and m_constBoolMember have the squiggly underline indicating an invalid symbol.

When I typed a dot after felineFoo, the list contained only m_boolPointer, m_constBoolPointer, and m_intMember. The others -- m_boolMember and m_constBoolMember -- were missing

Cheers,

Bob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 24 2014 :  8:04:56 PM  Show Profile  Reply with Quote
If you add a bool pointer to one of the problem classes is this member shown correctly, and listed in listboxes?

Have you done a VA database rebuild since this problem started? I am not sure this will help, but it should be a fairly fast test. Simply press:

VA Options -> Performance -> Rebuild symbol databases

then restart the IDE and reload your solution.

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 29 2014 :  07:37:49 AM  Show Profile  Reply with Quote
Hello,

I posted this information a couple of days ago, but it looks like it got lost. In any event, here it is again...

I added a bool* member variable, and VA handles it correctly. It shows up in list boxes and VA View, and gets colorized properly.
I rebuilt the database, but that did not solve the problem with bool member variables.

Thanks,

Bob
Go to Top of Page

.oisyn
Tomato Guru

162 Posts

Posted - Jan 29 2014 :  5:20:26 PM  Show Profile  Reply with Quote
I'm seeing the exact same thing in my project. No MFC though.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 30 2014 :  8:36:06 PM  Show Profile  Reply with Quote
Bob, apologies for the lost post, we had a technical problem with the forum that resulted in us rolling back to a backup, and loosing all posts in a 15 hour window, yours included. This has now been fixed, and hopefully was a one off problem, and won't happen again.

Can both of you do a quick check and see if you have a file called "va_stdafx.h" in the same directory as the .SLN or .VCPROJ files? This is used to help our parser, and since its a project specific helper file, it could be a factor. I doubt this is the problem, but its a quick check.

Bob, can you please load the problem solution, turn on VA logging, load one of the problem header files, and use the command:

VAssistX -> Tools -> Reparse Current File

please also show VA Outline for the file, and also show VA View, then place keyboard focus back into the editor, and now hover the mouse over the class name, so the known members are shown. Now close the IDE to stop the VA log files getting any bigger.

Turning on VA logging, and finding the log files is explained here:

https://wholetomato.fogbugz.com/default.asp?W305

Please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up. Hopefully the logs will offer some clues, since I really don't know what to make of this.


.oisyn which IDE are you using? Are you working in C, C++ or a mix of the two languages?

Can you please also try the "bool *" test and see if you get the same result, that member variables of this type are known and understood?

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Jan 31 2014 :  08:18:43 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline
Can both of you do a quick check and see if you have a file called "va_stdafx.h" in the same directory as the .SLN or .VCPROJ files?


I do not have that file in the solution folder.
quote:

Bob, can you please load the problem solution, turn on VA logging, load one of the problem header files, and use the command:

VAssistX -> Tools -> Reparse Current File

please also show VA Outline for the file, and also show VA View, then place keyboard focus back into the editor, and now hover the mouse over the class name, so the known members are shown. Now close the IDE to stop the VA log files getting any bigger.



I sent the log files, as requested. I hope they contain something useful.

Cheers,

Bob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 31 2014 :  5:10:00 PM  Show Profile  Reply with Quote
I have the log files, thank you for these, hopefully they will offer some clues:

case=79967

zen is the art of being at one with the two'ness
Go to Top of Page

.oisyn
Tomato Guru

162 Posts

Posted - Jan 31 2014 :  5:15:20 PM  Show Profile  Reply with Quote
I'm using VS 2012. I do not have any va_stdafx.h file on my harddrive.

I did a goto definition on "bool" and I think I found my culprit. It's libcurl, which is C code and has the following code:
/*
 * 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.
 * On non-C99 platforms there's no bool, so define an enum for that.
 * On C99 platforms 'false' and 'true' also exist. Enum uses a
 * global namespace though, so use bool_false and bool_true.
 */

#ifndef HAVE_BOOL_T
  typedef enum {
      bool_false = 0,
      bool_true  = 1
  } bool;

/*
 * Use a define to let 'true' and 'false' use those enums.  There
 * are currently no use of true and false in libcurl proper, but
 * there are some in the examples. This will cater for any later
 * code happening to use true and false.
 */
#  define false bool_false
#  define true  bool_true
#  define HAVE_BOOL_T
#endif


I'm going to try to fix this by having a #define HAVE_BOOL_T in the aforementioned va_stdafx.h file.

Edited by - .oisyn on Jan 31 2014 5:16:17 PM
Go to Top of Page

.oisyn
Tomato Guru

162 Posts

Posted - Jan 31 2014 :  5:26:30 PM  Show Profile  Reply with Quote
That doesn't seem to work.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 31 2014 :  5:28:32 PM  Show Profile  Reply with Quote
If you are not used to using the "va_stdafx.h" file, it is described here:

https://wholetomato.fogbugz.com/default.asp?W302

I am not quite sure what to suggest putting into the file, based on this, but:

#define false false
#define true true


might do the trick.

zen is the art of being at one with the two'ness
Go to Top of Page

.oisyn
Tomato Guru

162 Posts

Posted - Jan 31 2014 :  5:34:51 PM  Show Profile  Reply with Quote
Well it's 'bool' that's been given issues, not 'true' and 'false', so I should probably be needing
#define bool bool

then? I'll give that a try.

I though by having HAVE_BOOL_T defined, Visual Assist might not parse that piece of code from libcurl because it's inside an #ifndef HAVE_BOOL_T
Go to Top of Page

.oisyn
Tomato Guru

162 Posts

Posted - Jan 31 2014 :  5:37:06 PM  Show Profile  Reply with Quote
Yes that works! Excellent!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Jan 31 2014 :  5:57:53 PM  Show Profile  Reply with Quote
Actually yes, you are right, #define bool bool is the more sensible way forward here.

This is happening since VA is parsing even inactive code, which happens by design, since we want to be able to support and help you with the inactive code, e.g. a block wrapped in #ifdef _DEBUG #endif that you are working on.

Thank you for the update, its good to know what is going wrong here


rlcave3rd can you please try making a "va_stdafx.h" file in the same directory as your .SLN file, and adding the code:

#define bool bool

you need to make sure the file ends with a blank line. Now press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE. Does this fix the problem? If you are seeing something similar to .oisyn then it should, fingers crossed.

zen is the art of being at one with the two'ness
Go to Top of Page

rlcave3rd
New Member

USA
9 Posts

Posted - Feb 03 2014 :  08:11:29 AM  Show Profile  Reply with Quote
Hello,

quote:
Originally posted by feline

rlcave3rd can you please try making a "va_stdafx.h" file in the same directory as your .SLN file, and adding the code:

#define bool bool

you need to make sure the file ends with a blank line. Now press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE. Does this fix the problem? If you are seeing something similar to .oisyn then it should, fingers crossed.



Good news! That seems to have resolved the problem. Thank you for your persistence on this issue.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Feb 04 2014 :  1:51:51 PM  Show Profile  Reply with Quote
Thank you for the update, its good to know this has been fixed, and it was such a simple fix when we finally found the problem Some problems take longer to sort out than others, so I don't give up easily, getting things fixing things is important.

I have made a note of this for future reference, in case this problem comes up again.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000