开发者

Visual Studio 2008 Intellisense with struct keyword

I am using visual studio 2008 express edition.

A normal win32 console C project with the code below:

int main(void)
{

struct _addr_info
{
    char name[30];
    char street[40];
    char city[20];
    char state[3];
    unsigned long int zip;
} addr_info;

addr_info.zip = 12345;


return 0;
}

Generally for structures intellisense will list the members. Here it doesnt however it compiles fine and at debugging i checked the data also gets entered properly. Am i doing something wrong.

even this code has same prob.

int main(void)
{

struct 
{
    char name[30];
    char street[40];
    char city[20];
开发者_如何转开发    char state[3];
    unsigned long int zip;
} addr_info;

addr_info.zip = 12345;


return 0;
}

This code below also doesn't work.

int main(void)
{

struct _addr_info
{
    char name[30];
    char street[40];
    char city[20];
    char state[3];
    unsigned long int zip;
} ;

struct _addr_info addr_info;
addr_info.zip = 12345;


return 0;
}

The code below works fine and list the members of the structure.

struct _addr_info
{
    char name[30];
    char street[40];
    char city[20];
    char state[3];
    unsigned long int zip;
} addr_info;

int main(void)
{
    addr_info.zip = 12345;
    return 0;
}

This one too.

    struct _addr_info
{
    char name[30];
    char street[40];
    char city[20];
    char state[3];
    unsigned long int zip;
} ;

int main(void)
{
    struct _addr_info addr_info;
    addr_info.zip = 12345;
    return 0;
}


I posted on MSDN forum and got the answer pointed by the link.

http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/8a22dc4a-3632-4cb9-92a3-63a18b55e7b6

Hope this helps.


If you're used to Visual C#'s intellisense then you'll be extremely disappointed in Visual C++'s as it's very buggy. You can try deleting the ncb files but you're better off using something like Visual Assist which is an intellisense replacement.


Answer copied from [ Why does Visual Studio not know the correct definition of this struct? ]

There's something about your situation described by Microsoft: http://support.microsoft.com/kb/822551

WORKAROUND: Microsoft strongly recommends that you use unique type definitions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜