473,466 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

compiling a simple program

Hi there ...

I need to know how to compile the program idba1EnableSignal.c to get
idba1EnableSignal.o.
I tried like below but I got some errors. I believe it is because it
cannot find signal.h but I just don't know how to include this when
compiling. I am not a c-programmer.

$ gcc -c idba1EnableSignal.c -ansi
idba1EnableSignal.c: In function `idba1EnableSignal':
idba1EnableSignal.c:25: error: `SIGHUP' undeclared (first use in this
function)
idba1EnableSignal.c:25: error: (Each undeclared identifier is reported
only once
idba1EnableSignal.c:25: error: for each function it appears in.)
idba1EnableSignal.c:26: error: `SIGQUIT' undeclared (first use in this
function)
idba1EnableSignal.c:27: error: `SIGKILL' undeclared (first use in this
function)

idba1EnableSignal.c
------------------------
#include <sys/signal.h>

extern void CleanUp();

void idba1EnableSignal()
{
signal(SIGINT, CleanUp);
signal(SIGHUP, CleanUp);
signal(SIGQUIT, CleanUp);
signal(SIGKILL, CleanUp);

return;
}

Thanks.
Daud

Nov 14 '05 #1
5 5546
sys/signal.h file is in /usr/include/sys/include

By defaukt compiler looks into /usr/include.

Try giving the path of sys/signal.h using -I option in gcc

Nov 14 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"khurana77" <rk******@gmail.com> writes:
sys/signal.h file is in /usr/include/sys/include

By defaukt compiler looks into /usr/include.

Try giving the path of sys/signal.h using -I option in gcc


This is offtopic, but also incorrect. The correct include is
<signal.h> (see SUSv3).
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFCnFEEVcFcaSW/uEgRAsAqAKCQOJtK+ftnBofU91u/jKbvdbTGxwCg5I6G
2YV/KZOBKipoiumKo+2pnT4=
=5XiC
-----END PGP SIGNATURE-----
Nov 14 '05 #3
Daud wrote:
.... snip ... #include <sys/signal.h>
No such thing in standard C - use <signal.h>

extern void CleanUp();

void idba1EnableSignal()
{
signal(SIGINT, CleanUp);
signal(SIGHUP, CleanUp);
signal(SIGQUIT, CleanUp);
signal(SIGKILL, CleanUp);

return;
}
Only <signal.h> is defined. You seem to be using some system
dependant things, so try a newsgroup that deals with your system.From N869.


[#3] The macros defined are

SIG_DFL
SIG_ERR
SIG_IGN

which expand to constant expressions with distinct values
that have type compatible with the second argument to, and
the return value of, the signal function, and whose values
compare unequal to the address of any declarable function;
and the following, which expand to positive integer constant
expressions with type int and distinct values that are the
signal numbers, each corresponding to the specified
condition:

SIGABRT abnormal termination, such as is initiated
by the abort function

SIGFPE an erroneous arithmetic operation, such as
zero divide or an operation resulting in
overflow

SIGILL detection of an invalid function image, such
as an invalid instruction

SIGINT receipt of an interactive attention signal

SIGSEGV an invalid access to storage

SIGTERM a termination request sent to the program

[#4] An implementation need not generate any of these
signals, except as a result of explicit calls to the raise
function. Additional signals and pointers to undeclarable
functions, with macro definitions beginning, respectively,
with the letters SIG and an uppercase letter or with SIG_
and an uppercase letter,197) may also be specified by the
implementation. The complete set of signals, their
semantics, and their default handling is implementation-
defined; all signal numbers shall be positive.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #4
Its One and the same thing in Linux sys/signal.h includes the file
signal.h as
#include <signal.h>

Nov 14 '05 #5

"khurana77" <rk******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Its One and the same thing in Linux sys/signal.h includes the file
signal.h as
#include <signal.h>


On FreeBSD signal.h includes sys/signal.h (not vice versa)
I'd take another look at your headers - according to the standard
the macros are supposed to be defined after the inclusion of signal.h
(note - the standard doesn't refer to sys/signal.h anywhere!)
That being said, the correct include is <signal.h> and NOT sys/signal.h

Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: smjmitchell | last post by:
Hi All, I have written a program in VB 6.0 that I would like to distribute to many users (most likely via freeware / shareware). The program is a relatively simple and does not call any external...
3
by: Seelan Rajagopal | last post by:
Hey Guys! Im Compiling a simple program is the command promt. I have set all the paths needed to run the compiler. But when I use csc myprogram.cs, it says that the program does not have an entry...
7
by: Sverker Nilsson | last post by:
I have been informed that Guppy-PE (http://guppy-pe.sourceforge.net) has failed to compile its extension modules with a Microsoft .NET 2003 compiler under Windows 2000. One of the problems,...
9
by: kileran | last post by:
I used to program. However i'm finding that statment now means as much as a 40 year old saying "I used to be cool". I've got a program here, and the code for it, and i want to make a custom...
4
by: Dinakara | last post by:
Hi, I am programming with C++ using the gcc compiler. Compiler : gcc version 3.4.3 OS : Red Hat 3.4.3-9.EL4. I am not able to run the following program that declares a Template:...
23
by: Babak | last post by:
Hi Everyone, I've written a standard C code for a simple finite element analysis in MSVC++ . When I save the file as a cpp file, it compiles and runs perfectly, but when I save it as a c file,...
9
by: Sheldon | last post by:
Good day Everyone, I am a still very new at learning C and I have thrown myself in the deep end. I started with a simple program and kept widening the scope. This has taught me many things about...
2
by: fangee | last post by:
Hi everybody, I'm facing a problem trying to statically compile a simple c++ prog, something like: int main(){ return 1; } Using g++ 2.95.4 (I must use this to compile a much more complex...
10
by: Tomás Ó hÉilidhe | last post by:
I'd post this on a gcc newsgroup but I'd be more productive talking to the wall. Anyway, let's say someone throws some source code at you for a particular program and says, "Just compile it, it...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.