Thread: IntelliSense: declaration is incompatible with

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    29

    IntelliSense: declaration is incompatible with

    Hi all

    I have this in a .C file, the last line of this declaration is line 19:

    Code:
    EXTERN struct 
    	{
    	int len;
    	int pitch;
    	int size;
    	} PrTbl[6];
    which seems to be perfectly correct, except that the VC++ 2010 give me this error message that does not make any sense to me. It looks like a circular error that the declaration is incompatible with itself:

    IntelliSense: declaration is incompatible with "struct <unnamed> PrTbl[6]" (declared at line 19)

    I tried to give a name to the struct, but the message was the same.
    Any idea please.Thanks
    ZA

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Consider this example, separating the struct declaration from the array declaration.
    Code:
    struct foo
    	{
    	int len;
    	int pitch;
    	int size;
    	};
    EXTERN struct foo PrTbl[6];
    One of the problems with combining it all in one (especially when it is an anonymous struct) is actually declaring the instance.
    Code:
    extern struct { int member; } array[10];
    struct { int member; } array[10];
    are two distinct (anonymous) structs, even though both contain the same members.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    29

    Separation of declarations

    It did the trick...
    Thanks
    ZA

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM