Multiple declaration for 'fd_set' in winsock2- Builder C++ 5

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tkujalow
Posts: 5
Joined: Mon 01 Sep 2008 08:48
Location: Poznań - Poland

Multiple declaration for 'fd_set' in winsock2- Builder C++ 5

Post by tkujalow » Wed 22 Sep 2010 08:29

I'm using ODAC for Builder C++ 5 since about 4 years in my server application. After upgrade from 6.50.0.39 to 7.xx I got error: " [C++ Error] winsock2.h(103): E2238 Multiple declaration for 'fd_set' [C++ Error] winsock.h(55): E2344 Earlier declaration of 'fd_set' ". I checked some previous versions and I found that this error began with wersion 6.90.0.54. Version 6.90.0.53 is ok, but 6.90.0.54 not.

Could you explain what is wrong with this new verstions of ODAC (since 6.90.0.54).

1) Compiler Errors:

[C++ Error] winsock2.h(103): E2238 Multiple declaration for 'fd_set'
[C++ Error] winsock.h(55): E2344 Earlier declaration of 'fd_set'
[C++ Error] winsock2.h(106): E2146 Need an identifier to declare
[C++ Error] winsock2.h(147): E2238 Multiple declaration for 'timeval'
[C++ Error] winsock.h(98): E2344 Earlier declaration of 'timeval'
[C++ Error] winsock2.h(203): E2238 Multiple declaration for 'hostent'
[C++ Error] winsock.h(154): E2344 Earlier declaration of 'hostent'
[C++ Error] winsock2.h(216): E2238 Multiple declaration for 'netent'
[C++ Error] winsock.h(167): E2344 Earlier declaration of 'netent'
[C++ Error] winsock2.h(223): E2238 Multiple declaration for 'servent'
[C++ Error] winsock.h(174): E2344 Earlier declaration of 'servent'
[C++ Error] winsock2.h(235): E2238 Multiple declaration for 'protoent'
[C++ Error] winsock.h(186): E2344 Earlier declaration of 'protoent'
[C++ Error] winsock2.h(319): E2238 Multiple declaration for 'in_addr'
[C++ Error] winsock.h(270): E2344 Earlier declaration of 'in_addr'
[C++ Error] winsock2.h(377): E2238 Multiple declaration for 'sockaddr_in'
[C++ Error] winsock.h(320): E2344 Earlier declaration of 'sockaddr_in'
[C++ Error] winsock2.h(387): E2238 Multiple declaration for 'WSAData'
[C++ Error] winsock.h(330): E2344 Earlier declaration of 'WSAData'
[C++ Error] winsock2.h(403): E2146 Need an identifier to declare
[C++ Error] winsock2.h(536): E2238 Multiple declaration for 'sockaddr'
[C++ Error] winsock.h(493): E2344 Earlier declaration of 'sockaddr'
[C++ Error] winsock2.h(545): E2238 Multiple declaration for 'sockproto'
[C++ Error] winsock.h(502): E2344 Earlier declaration of 'sockproto'
[C++ Error] winsock2.h(584): E2238 Multiple declaration for 'linger'
[C++ Error] winsock2.h(584): E2228 Too many error or warning messages
....

2) Compiler shows it in this place:

Winsock2.h

.....

typedef struct fd_set {
u_int fd_count; /* how many are SET? */
SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} fd_set;

extern int PASCAL FAR __WSAFDIsSet(SOCKET, fd_set FAR *);
.....

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 22 Sep 2010 12:48

Hello,

I could not reproduce the problem.
Please download the latest ODAC version (7.00.0.1) and try again.
If the problem persists, please contact me.

tkujalow
Posts: 5
Joined: Mon 01 Sep 2008 08:48
Location: Poznań - Poland

Post by tkujalow » Wed 22 Sep 2010 13:14

In ODAC version (7.00.0.1) is the same.
I tested:
7.00.0.1 - WRONG
6.90.0.60 - WRONG
6.90.0.56 - WRONG
6.90.0.55 - WRONG
6.90.0.54 - WRONG
6.90.0.53 - OK
6.90.0.51 - OK
6.50.0.39 - OK

I can test other versions if you want.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 23 Sep 2010 07:06

Hello,

A similar problem was discussed on http://www.devart.com/forums/viewtopic. ... ight=e2238, please see this thread. If it doesn't help please send me a complete small sample to alexp*devart*com to demonstrate this problem.

tkujalow
Posts: 5
Joined: Mon 01 Sep 2008 08:48
Location: Poznań - Poland

Post by tkujalow » Mon 27 Sep 2010 07:22

It helped:
replace in DBMonitorMessages.hpp the following line:
Code:
#include <WinSock.hpp>
with
Code:
#include <WinSock2.h>

(WinSock.hpp=>WinSock2.h)

Is it replaced in new versions of dbmonitor, or I have remember about this bug, and always change this line ?
Last edited by tkujalow on Thu 24 Apr 2014 13:31, edited 1 time in total.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 27 Sep 2010 08:09

Hello,

This is not a bug. CBuilder 5 works with WinSock by default, however some third-party components require WinSock2. If your application uses such components, you should manually replace WinSock with WinSock2 every time.

tkujalow
Posts: 5
Joined: Mon 01 Sep 2008 08:48
Location: Pozna&#324; - Poland

Post by tkujalow » Mon 27 Sep 2010 08:31

OK, but I never used DBMoniotor, so why ODAC components use this hpp file. It is very strange. I look up any link to this declaration file, but there's nothing. How can I remove this reference to dbmonitor include file in my application?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 27 Sep 2010 09:36

Hello,

The TDBMonitor class class is used in the ODAC components, so even if you don't use DBMonitor in your application, the ODAC components need this file for correct work.

Post Reply