[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3454.0. "usleep not declared" by BARNA::DSMAIL () Tue Feb 18 1997 14:09

Hi people:

I have a problem with a customer compiling a progran with the function usleep.
If the customer compiles with C no problem,but this file is compiled with
cxx gives the following error:
usleep is not declared.
Operating System is 3.2F.
File contains the following:
#include <unistd.h>
main()
{
usleep(1000);
}
command compiler is :cxx -o output file input file.c
I have tested with Digital UNix 4.0b .Ok
Any idea?
Francesc
T.RTitleUserPersonal
Name
DateLines
3454.1Workaround (-D_XOPEN_SOURCE_EXTENDED) ?DECC::SULLIVANJeff SullivanTue Feb 18 1997 15:1719
I took a look at /usr/include/unistd.h. Your program will work with C++ if you
define _XOPEN_SOURCE_EXTENDED (or _XOPEN_SOURCE for a slightly different
interface).

The following is a test on Digital UNIX V4.0 with DEC C++ V5.5:

% cxx t.cxx                         
cxx: Error: t.cxx, line 5: In this statement, "usleep" is not declared.
usleep(1000);
^
% cxx -D_XOPEN_SOURCE_EXTENDED t.cxx

The fact that it doesn't work "out of the box" makes me think that it's a
problem in the unistd.h header file. You might consider filing an OSF_QAR to get
this resolved in the header file. If you're not sure how to do that, feel free
to contact me offline (well, "online" technically...).

-Jeff

3454.2worksBARNA::DSMAILThu Feb 27 1997 14:267
    
    	Hi jeff:
    
    
    	Thanks.It works
    
    	Francesc