Opened 14 years ago

Last modified 8 years ago

#2660 reopened Library Submissions

`fd_set' has not been declared

Reported by: jens.luedicke@… Owned by: az_sw_dude
Milestone: Website 1.X Component: xpressive
Version: Boost.Build-M3 Severity: Not Applicable
Keywords: Cc: gvenkatsm@…

Description

I'm using Boost.Thread and Boost.Asio on Cygwin.

If I include boost/thread.hpp, without boost/asio.hpp first, I get a compiler error:

In file included from /usr/include/cygwin/sys_time.h:13,

from /usr/include/sys/time.h:27, from D:/local/boost/include/boost-1_37/boost/date_time/c_time.hpp:28, from D:/local/boost/include/boost-1_37/boost/date_time/microsec_time_clock.hpp:18, from D:/local/boost/include/boost-1_37/boost/thread/thread_time.hpp:9, from D:/local/boost/include/boost-1_37/boost/thread/locks.hpp:12, from D:/local/boost/include/boost-1_37/boost/thread/pthread/mutex.hpp:11, from D:/local/boost/include/boost-1_37/boost/thread/mutex.hpp:16, from D:/local/boost/include/boost-1_37/boost/thread/pthread/thread_data.hpp:12, from D:/local/boost/include/boost-1_37/boost/thread/thread.hpp:17, from D:/local/boost/include/boost-1_37/boost/thread.hpp:13, from src/flightpath_controller.cpp:27:

/usr/include/sys/select.h:31: error: `fd_set' has not been declared /usr/include/sys/select.h:31: error: `fd_set' has not been declared /usr/include/sys/select.h:31: error: `fd_set' has not been declared /usr/include/sys/select.h:33: error: `fd_set' has not been declared /usr/include/sys/select.h:33: error: `fd_set' has not been declared /usr/include/sys/select.h:33: error: `fd_set' has not been declared make: * [build/flightpath_controller.o] Error 1

A workaround for this issue is to include boost/asio.hpp before boost/thread.hpp within the given sourcefile.

Change History (12)

comment:1 by Steven Watanabe, 14 years ago

Component: Nonethread
Owner: set to Anthony Williams

So to be clear, do you get an error from a file that contains only:

#include <boost/thread.hpp>

in reply to:  1 comment:2 by jens.luedicke@…, 14 years ago

Replying to steven_watanabe:

So to be clear, do you get an error from a file that contains only:

#include <boost/thread.hpp>

Yes.

comment:3 by Steven Watanabe, 14 years ago

Ok. It works for me.

Do you have any compiler flags beyond the absolute minimum:

g++ -I D:/local/boost/include/boost-1_37 -c minimal_test_file.cpp

Does the code compile if you include sys/select.h only? If so, can you find the closest file in the chain of #includes that causes an error.

in reply to:  3 ; comment:4 by Jens Luedicke <jens.luedicke@…>, 14 years ago

Replying to steven_watanabe:

Ok. It works for me.

Do you have any compiler flags beyond the absolute minimum:

g++ -I D:/local/boost/include/boost-1_37 -c minimal_test_file.cpp

Does the code compile if you include sys/select.h only? If so, can you find the closest file in the chain of #includes that causes an error.

Yes, it compiles.

If I add "-DUSE_W32_SOCKETS" to the compiler flags, the minimal file fails to compile.

in reply to:  4 comment:5 by Steven Watanabe, 14 years ago

Replying to Jens Luedicke <jens.luedicke@gmail.com>:

If I add "-DUSE_W32_SOCKETS" to the compiler flags, the minimal file fails to compile.

Thanks. I can reproduce the problem now.

comment:6 by Steven Watanabe, 14 years ago

I've just tested sys/select.h by itself and it fails for me. Are you sure that it compiles:

$ cat test.cpp
#include <sys/select.h>

$ g++ test.cpp -c -D__USE_W32_SOCKETS
In file included from test.cpp:1:
/usr/include/sys/select.h:31: error: `fd_set' has not been declared
/usr/include/sys/select.h:31: error: `fd_set' has not been declared
/usr/include/sys/select.h:31: error: `fd_set' has not been declared
/usr/include/sys/select.h:33: error: `fd_set' has not been declared
/usr/include/sys/select.h:33: error: `fd_set' has not been declared
/usr/include/sys/select.h:33: error: `fd_set' has not been declared

in reply to:  6 ; comment:7 by jens.luedicke@…, 14 years ago

Replying to steven_watanabe:

I've just tested sys/select.h by itself and it fails for me. Are you sure that it compiles:

As far as I can remeber it does not compile.

in reply to:  7 ; comment:8 by Steven Watanabe, 14 years ago

Component: threaddate_time
Owner: changed from Anthony Williams to az_sw_dude

Replying to jens.luedicke@gmail.com:

Replying to steven_watanabe:

I've just tested sys/select.h by itself and it fails for me. Are you sure that it compiles:

As far as I can remeber it does not compile.

Sorry. I misinterpreted Yes, it compiles..

This seems to be a cygwin problem rather than a Boost problem as the error is caused by date_time's inclusion of sys/time.h.

in reply to:  8 comment:9 by anonymous, 14 years ago

Replying to steven_watanabe:

This seems to be a cygwin problem rather than a Boost problem as the error is caused by date_time's inclusion of sys/time.h.

Has this been communicated to the Cygwin development folks?

comment:10 by gvenkatsm@…, 13 years ago

Cc: gvenkatsm@… added

It seems direct linking of windows libraries and inclusion of headers is not allowed in cygwin. For details its in the following link.

http://www.cygwin.com/ml/cygwin/2008-08/msg00133.html

comment:11 by Steven Watanabe, 12 years ago

Resolution: invalid
Status: newclosed

comment:12 by Smithg195, 8 years ago

Component: date_timexpressive
Milestone: Boost 1.38.0Website 1.X
Resolution: invalid
Severity: ProblemNot Applicable
Status: closedreopened
Type: BugsLibrary Submissions
Version: Boost 1.37.0Boost.Build-M3

Do you mind if I quote a few of your posts as long as I provide credit and sources back to your weblog? My blog is in the very same niche as yours and my users would truly benefit from a lot of the information you present here. Please let me know if this alright with you. Thank you! bekabcdkbedbckab

Note: See TracTickets for help on using tickets.