Thread: Declaring struct problem

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    7

    Declaring struct problem

    Hi,

    I'm learning how to use semaphore under linux, but I'm having an error when I declare a struct I never had under windows.

    error: redefinition of 'struct sembuf'

    Code:
    typedef struct sembuf
        {
        unsigned short sem_num;
        short sem_op;
        short sem_flg;
        }sembuf;
    
    int main()
        {
        sembuf* sbuf;
        }
    I searched the linux board but I can't find a solution for this error.
    Some help would be appreciated.

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    sembuf must have been defined in one of the headers you included in your program.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    7
    It worked, I changed sembuf for test and it work.

    Thx a lot for the fast reply.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  2. Converting from C to C++
    By Taka in forum C++ Programming
    Replies: 5
    Last Post: 04-08-2009, 02:16 AM
  3. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. syntax linked list problem & struct problem
    By beely in forum C Programming
    Replies: 5
    Last Post: 11-11-2002, 09:14 AM