Re: Error Occured during compilation



"abdur_rab7@xxxxxxxxxxx" <abdur_rab7@xxxxxxxxxxx> writes:
> Hi Keith Thompson,

Why are you addressing me personally? This is a newgroup, not e-mail.

I will ask you again to read <http://cfaj.freeshell.org/google/>.
Please please please don't post to Usenet again until you read this
web page and follow its advice.

> Here is the sample programm in C
>
> #include <stdio.h>
> #include <sys/types.h>
> #include <time.h>

Again, <sys/types.h> is not a standard C header. (It's probably
defined by POSIX, but not by ISO C.) It is therefore off-topic in
this newsgroup.

> int hangOn (int nNanoSecond)
> {
> struct timespec tmsp;
> /*tmsp.tv_sec = (time_t) 0;
> if (nNanoSecond) tmsp.tv_nsec = nNanoSecond;
> else tmsp.tv_nsec = 110;
> if (nanosleep (&tmsp, NULL) < 0) return -1;
> */
> return (0);
>
> }

Several lines of this function are commented out. I suggest deleting
them before you post your code; they're only causing confusion.

> int main ()
> {
> printf ("\n The function hangOn is being called\n");
> printf ("\n The Return Value is : %d\n", hangOn (110));
> return (0);
> }
>
> I get two different errors when i compile it with 'gcc' as well as
> 'g++' compiler
>
> gcc compilation
> -----------------------
> bash-2.02$ gcc -o tes test.c
> test.c: In function `hangOn':

If you don't show us the actual error message, we can't help you.

> g++ compilation
[snip]

g++ is a C++ compiler. We don't care what it does. If you have
questions about C++, post to comp.lang.c++.

<OFF-TOPIC>
I compiled your code under Cygwin, and got no error messages. I don't
know what your problem is. Perhaps you need to upgrade your system.
(Cygwin makes this easy to do, using the same mechanism you used to
install it in the first place.)
</OFF-TOPIC>

If you can reproduce the problem with a *portable* C program that
doesn't depend on any non-standard headers, we may be able to help
you. Try incorporating the relevant declarations from <sys/types.h>
into your program, and dropping the "#include <sys/types.h>". Or post
to a Cygwin mailing list; see the Cygwin web site for details.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages