Go to Fails Definition - Visual Studio 2008

I am writing a C ++ application in Visual Studio 2008. It has many specific structures in several header files, for example:

#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 the source file, these specific 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... */ } 

Despite the fact that it compiles successfully with 0 errors and 0 warnings, sometimes when I right-click on a custom data type (for example, in MyFunc ), it gives me an error:

The character 'myStruct_t' is undefined.

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 finds the definition of myStruct_t at compilation, but cannot find it when I try to use the Go to definition function. The only thing that happens to me is that this application has many defined structures, single-byte aligned, but that should not matter. Does anyone know how to fix this?

+8
c ++ visual-studio-2008
source share
2 answers

Try closing your solution, and then delete the * .sdf file. When you open your solution again, Intellisense will be forced to rebuild its database, and this may solve your problem.

Edit: Bug fixed.

Edit 2: for legacy ones, if you are using Visual Studio 2008 or later, you must delete all * .ncb files.

+9
source share
  • Complete the visual studio process. (In Visual Studio 2005, you may need to delete all *.ncb files when you delete the visual studio process).
  • Reopen the solution and clean the solution: Build -> Clean Solution .
+1
source share

All Articles