I'm writing a C++ application in Visual Studio 2008. It has a lot of defined structures in several header files, such as:
#pragma pack( push , 1 ) // align on a 1-byte boundary
typedef struct myStruct_tag
{
/* ... */
} myStruct_t;
#pragma pack( pop ) // end 1-byte boundary alignment
In a source file, these defined structures are used as such:
void MyFunc( void )
{
myStruct_t * myStruct = NULL;
myStruct = (myStruct_t *)malloc( sizeof(myStruct_t) );
/* and so forth and so on... */
}
Even though it successfully compiles with 0 errors and 0 warnings, sometimes when I right-click a custom data type (such as in MyFunc
) it gives me an error:
The symbol 'myStruct_t' is not defined.
Then I click OK to close the dialog box and press Ctrl+Alt+F7 to rebuild the solution. It builds without any errors or warnings, so I know that it is finding the definition of myStruct_t
when it compiles, but it cannot find it when I try to use the Go to Definition feature. The only thing that occurs to me is that this application has a lot of defined structures, single-byte aligned, but that shouldn't make a difference. Does anybody know how to fix this?
Try closing your solution and then deleting the *.sdf file. When you reopen your solution Intellisense will be forced to rebuild its database and this might solve your problem.
Edit: Fixed mistake pointed
Edit 2: For legacy, in case you're using Visual Studio 2008 or older, you should delete all *.ncb files.
*.ncb
files when the visual studio process is killed)Build -> Clean
Solution
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With