Board index » cppbuilder » multiple declaration for fd_set

multiple declaration for fd_set


2005-07-30 05:40:14 AM
cppbuilder74
Hi there!
In the project which has both TServerSocket and Indy components compiler
says
multiple declaration for fd_set (in winsock2.h)
and
Earlier declaration of fd_set (in winsock.h)
How to handle this?
Thank You
--
Regards,
Sergey Muschin
 
 

Re:multiple declaration for fd_set

"Sergey Muschin" < XXXX@XXXXX.COM >wrote in message
Quote
How to handle this?
By not using multiple socket libraries in the same project to begin with.
Winsock.h and Winsock2.h cannot coexist in the same project together.
Why are you using TServerSocket if you are also using Indy? Why are you
using Indy if you are using TServerSocket?
Gambit
 

Re:multiple declaration for fd_set

"Sergey Muschin" < XXXX@XXXXX.COM >wrote in message
Quote
Hi there!

In the project which has both TServerSocket and Indy components compiler
says
multiple declaration for fd_set (in winsock2.h)

and

Earlier declaration of fd_set (in winsock.h)

How to handle this?
Move the Indy includes above the TServerSocket includes.
HTH
Jonathan
 

{smallsort}

Re:multiple declaration for fd_set

I do not like IdTCPServer but i do like IdIPWatch
Quote

Why are you using TServerSocket if you are also using Indy? Why are you
using Indy if you are using TServerSocket?


Gambit


 

Re:multiple declaration for fd_set

Already tried that, did not wark out :(
/---------------------------------------------------------------------------
#ifndef untKioskEngineH
#define untKioskEngineH
//--------------------------------------------------------------------------
-
#include <IdBaseComponent.hpp>
#include <IdComponent.hpp>
#include "IdSMTPServer.hpp"
#include <IdTCPServer.hpp>
#include <IdIPWatch.hpp>
#include "..\\common\\untEngAPI.h"
#include <Classes.hpp>
#include <ScktComp.hpp>
//
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <SvcMgr.hpp>
#include <ExtCtrls.hpp>
#include <AppEvnts.hpp>
#include <IniFiles.hpp>
#include <Registry.hpp>
#include <memory>
Quote

Move the Indy includes above the TServerSocket includes.

HTH

Jonathan


 

Re:multiple declaration for fd_set

"Sergey Muschin" < XXXX@XXXXX.COM >wrote in message
Quote
Already tried that, did not wark out :(
Do you want the "hacking" approach ? <g>
Go through all the "earlier" declarations in winsock.h and comment them
out.
It does work.
Jonathan
 

Re:multiple declaration for fd_set

"Sergey Muschin" < XXXX@XXXXX.COM >wrote in message
Quote
I do not like IdTCPServer
Why not?
Gambit
 

Re:multiple declaration for fd_set

"Jonathan Benedicto" < XXXX@XXXXX.COM >wrote in message
Quote
Move the Indy includes above the TServerSocket includes.
That does not usually work, because the VCL includes windows.h, which in
turn includes winsock.h before any VCL headers are included. If winsock.h
is included before winsock2.h then all hell breaks lose with winsock2.h, as
is evident by Sergey's original message. On the other hand, if winsock2.h
is included before winsock.h, winsock2.h disables winsock.h and all is good.
Gambit
 

Re:multiple declaration for fd_set

"Jonathan Benedicto" < XXXX@XXXXX.COM >wrote in message
Quote
Go through all the "earlier" declarations in winsock.h and
comment them out.
I do not recommend that.
A better "hack" would be to simply make the Win32 API headers include
winsock2.h instead of winsock.h.
Gambit
 

Re:multiple declaration for fd_set

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
That does not usually work, because the VCL includes windows.h, which in
turn includes winsock.h before any VCL headers are included. If
winsock.h
is included before winsock2.h then all hell breaks lose with winsock2.h,
as
is evident by Sergey's original message. On the other hand, if
winsock2.h
is included before winsock.h, winsock2.h disables winsock.h and all is
good.
So then the OP should change his unit.cpp to read
#include <winsock2.h>
#include <vcl.h>
Jonathan
 

Re:multiple declaration for fd_set

"Jonathan Benedicto" < XXXX@XXXXX.COM >wrote in message
Quote
So then the OP should change his unit.cpp to read
<snip>
You have to be careful doing that. To do so can affect the IDE's
precompiled headers for the VCL.
Gambit
 

Re:multiple declaration for fd_set

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
You have to be careful doing that. To do so can affect the IDE's
precompiled headers for the VCL.
Wouldn't be simplest to add #include <winsock2.h>at the top of winsock.h ?
Jonathan
 

Re:multiple declaration for fd_set

Remy Lebeau (TeamB) wrote:
Quote
You have to be careful doing that. To do so can affect the IDE's
precompiled headers for the VCL.
To solve this problem, I included the line '_WINSOCKAPI_' in the
conditional defines option (from the project options).
Is this a bad approach? It works, though...
[]'s
Nelson
 

Re:multiple declaration for fd_set

To solve this problem, I included '_WINSOCKAPI_' in the conditional
defines (from the project options).
Is this a bad solution? It works, though...
[]'s
Nelson
 

Re:multiple declaration for fd_set

This seem to be working... :)
Thank You
Quote
#include <winsock2.h>
#include <vcl.h>

Jonathan