By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

rinning sleep() function in g++

P: 1
hi

I am using sleep function in a C++ program. when I compile this program using g++.I am getting followong error:

Expand|Select|Wrap|Line Numbers
  1. g++ samspec.cpp samspecCount.cpp -o samspec
  2. samspecCount.cpp: In function `void* Counter_fun(void*)':
  3. samspecCount.cpp:26: `sleep' undeclared (first use this function)
  4. samspecCount.cpp:26: (Each undeclared identifier is reported only once for each function it appears in.)
  5.  
I am using gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

I have also added #include<cstdlib>

still I am getting this error.

How to resolve this error.

Vini7
Oct 8 '07 #1
Share this Question
Share on Google+
1 Reply

arne
Expert 100+
P: 315
hi

I am using sleep function in a C++ program. when I compile this program using g++.I am getting followong error:

Expand|Select|Wrap|Line Numbers
  1. g++ samspec.cpp samspecCount.cpp -o samspec
  2. samspecCount.cpp: In function `void* Counter_fun(void*)':
  3. samspecCount.cpp:26: `sleep' undeclared (first use this function)
  4. samspecCount.cpp:26: (Each undeclared identifier is reported only once for each function it appears in.)
  5.  
I am using gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

I have also added #include<cstdlib>

still I am getting this error.

How to resolve this error.

Vini7

Try
Expand|Select|Wrap|Line Numbers
  1. #include <unistd.h>
  2.  
HTH,
arne
Oct 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.