Header file

P

paytam

How can I define my own header file?(I use linux,but when I use sine or
cosine and etc. I faced to error,so I read the header file but there
wasn't any prototype of that functions,so I decided to write my own
header file,but I don't know anything about the header files.Please
help me)
 
M

Mike Wahler

How can I define my own header file?

Just define it. You can use any editor
capable of saving a 'plain text' file.
(I use linux,

Your operating system is irrelevant when using
a platform-neutral language such as C.
but when I use sine or
cosine and etc.

There are no functions with those names the the
C standard library. Perhaps you meant 'sin' and
'cos'?
I faced to error,

What error? Show the code that gives the error.
so I read the header file

WHich header file?
but there
wasn't any prototype of that functions

Not in standard C library.
,so I decided to write my own
header file,

Now you're just guessing. Never a good idea.
but I don't know anything about the header files.

Get some books. See book reviews at www.accu.org for ideas.
Please
help me)

The standard functions 'cos()' and 'sin()' are declared
by standard header <math.h>

-Mike
 
N

Netocrat

How can I define my own header file?(I use linux,but when I use sine or
cosine and etc. I faced to error,so I read the header file but there
wasn't any prototype of that functions,so I decided to write my own
header file,but I don't know anything about the header files.Please
help me)

If the libraries for the trig math functions don't exist, there's no point
writing header files for them. If the libraries do exist, it's likely
that the header files do too and you simply need to find them in the
filesystem and direct your compiler to them (but if they genuinely don't,
we can help you to write/download them).

To find out what's really going on, post the exact error message, the
shortest complete version of the exact code causing it and the exact
command by which you're invoking your compiler.
 
P

paytam

I know that I must include math.h and use sin() and cos() functions,but
my main questions are
1) why in linux operating system there were not any trig function.I
used Red hat and Mandriva and debian but in all the header file was not
okay,I know that this is not relevant to OS
2) What should I write in that header file to work properly?
 
K

Keith Thompson

I know that I must include math.h and use sin() and cos() functions,but
my main questions are
1) why in linux operating system there were not any trig function.I
used Red hat and Mandriva and debian but in all the header file was not
okay,I know that this is not relevant to OS
2) What should I write in that header file to work properly?

The C standard provides several trig functions, including sin() and
cos(), declared in <math.h>. Any conforming C implementation will
support these. I've never seen a Linux system that didn't have a
conforming C implementation (possibly with some minor bugs), assuming
that gcc is installed.

What *exactly* do you mean when you say "in linux operating system
there were not any trig function"? What happens when you try to use
them? What makes you think "the header file was not okay"?

The C FAQ is at <http://www.eskimo.com/~scs/C-faq/faq.html>. You
might take a look at question 14.3.

If that *is* the problem, you could have saved yourself and the rest
of us a lot of time by showing us exactly what you tried and exactly
what happened when you tried it.
 
N

npavankumar

Hi Man
Actually The Linux gcc as well as cc compilers give errors ..........
So just use the g++ compiler and check that .......
 
M

Martin Ambuhl

Hi Man
Actually The Linux gcc as well as cc compilers give errors ..........
So just use the g++ compiler and check that .......

Whatever the hell you're responding to (a secret because you quote no
context), g++ is *not* an acceptable answer in < g++
is a C++ compiler, and C++ is *not* C. The C compiler in that suite is gcc.
 
P

pete

How can I define my own header file?
(I use linux,but when I use sine or
cosine and etc. I faced to error,so I read the header file but there
wasn't any prototype of that functions,so I decided to write my own
header file,but I don't know anything about the header files.Please
help me)

I'm guessing this might be your kind of problem:

http://www.eskimo.com/~scs/C-faq/q14.3.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,468
Latest member
Fannie44U3

Latest Threads

Top