Thread: SIG_BLOCK undeclared

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    569

    SIG_BLOCK undeclared

    I got the following error when compiling my code:

    Code:
    sender.c:156: warning: implicit declaration of function âsigemptysetâ
    sender.c:157: warning: implicit declaration of function âsigaddsetâ
    sender.c:160: warning: implicit declaration of function âsigactionâ
    sender.c:170: warning: implicit declaration of function âsigprocmaskâ
    sender.c:170: error: âSIG_BLOCKâ undeclared (first use in this function)
    sender.c:170: error: (Each undeclared identifier is reported only once
    sender.c:170: error: for each function it appears in.)
    sender.c:193: error: âSIG_UNBLOCKâ undeclared (first use in this function)
    any idea why? I've already included signal.h in the header file

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    Are you building with -ansi or one of the -std flags? If so, that's the problem. Those functions and macros you're using are not part of standard C, and so when you tell your compiler to conform to the C standard, it won't declare them.

    You have a few solutions. If you're trying to write portable standard C, then don't use those functions and macros.

    If you're trying to write code for POSIX systems, then you can tell the implementation that by setting the _XOPEN_SOURCE macro to a suitable value (600, for SuSv3, is what I use). This is best accomplished on the command-line, as in:
    Code:
    gcc -std=c99 -pedantic -Wall -D_XOPEN_SOURCE=600
    This is the proper way to enable POSIX support (proper being that defined by the POSIX standard itself).

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    Yes I am compiling it with -ansi, however I am not writing the code for a POSIX system.. I don't even know what that means.. so any other solutions to this?

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Can I ask you one question

    Quote Originally Posted by -EquinoX- View Post
    Yes I am compiling it with -ansi, however I am not writing the code for a POSIX system.. I don't even know what that means.. so any other solutions to this?

    Can I ASK YOU A question

    which is not related to your quote
    please

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM