structure typedefs error

This is a discussion on structure typedefs error within the C Programming forums, part of the General Programming Boards category; Hi, I'm trying to typedef a structure, and a pointer to a structure, but I'm getting compiler errors and I ...

  1. #1
    Registered User
    Join Date
    May 2008
    Location
    Australia
    Posts
    230

    structure typedefs error

    Hi, I'm trying to typedef a structure, and a pointer to a structure, but I'm getting compiler errors and I don't understand why. I'm using Visual C++ 6.0. Basically I want LPSTYLESTRUCT to be a pointer to STYLESTRUCT, here is my code:

    Code:
    typedef struct {
        DWORD styleOld;
        DWORD styleNew;
    } STYLESTRUCT, * LPSTYLESTRUCT;
    
    int main() {
    	
    	STYLESTRUCT styleStruct;
    	LPSTYLESTRUCT lpStyleStruct;
    
    	lpStyleStruct = &styleStruct;
    }
    And here are the errors:

    Code:
    error C2371: 'STYLESTRUCT' : redefinition; different basic types
            c:\program files\microsoft platform sdk\include\winuser.h(2773) : see declaration of 'STYLESTRUCT'
    
    error C2371: 'LPSTYLESTRUCT' : redefinition; different basic types
            c:\program files\microsoft platform sdk\include\winuser.h(2773) : see declaration of 'LPSTYLESTRUCT'
    Thanks.
    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    This same struct with the same typedef's is already defined in "winuser.h". Why don't you just use that one?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21