🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
14 messages
14 total messages Started by Sergey Muschin Fri, 29 Jul 2005 21:40
multiple declaration for fd_set
#3715
Author: Sergey Muschin
Date: Fri, 29 Jul 2005 21:40
20 lines
1253 bytes
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
#3716
Author: Remy Lebeau (TeamB)
Date: Fri, 29 Jul 2005 22:13
14 lines
1321 bytes
"Sergey Muschin" <sergey.muschin@tonservices.com> wrote in message
news:42eaa240$1@newsgroups.borland.com...

> 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
#3717
Author: Jonathan Benedicto
Date: Fri, 29 Jul 2005 22:17
19 lines
1390 bytes
"Sergey Muschin" <sergey.muschin@tonservices.com> wrote in message 
news:42eaa240$1@newsgroups.borland.com...
> 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 
Re: multiple declaration for fd_set
#3719
Author: Sergey Muschin
Date: Fri, 29 Jul 2005 22:38
10 lines
1256 bytes
I do not like IdTCPServer but i do like IdIPWatch

>
> 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
#3718
Author: Sergey Muschin
Date: Fri, 29 Jul 2005 22:46
37 lines
1881 bytes
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>


>
> Move the Indy includes above the TServerSocket includes.
>
> HTH
>
> Jonathan
>
>
Re: multiple declaration for fd_set
#3720
Author: Jonathan Benedicto
Date: Fri, 29 Jul 2005 22:51
12 lines
1319 bytes
"Sergey Muschin" <sergey.muschin@tonservices.com> wrote in message 
news:42eab1d4$1@newsgroups.borland.com...
> 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
#3721
Author: Remy Lebeau (TeamB)
Date: Fri, 29 Jul 2005 23:09
10 lines
1084 bytes
"Sergey Muschin" <sergey.muschin@tonservices.com> wrote in message
news:42eaafde@newsgroups.borland.com...

> I do not like IdTCPServer

Why not?


Gambit
Re: multiple declaration for fd_set
#3722
Author: Remy Lebeau (TeamB)
Date: Fri, 29 Jul 2005 23:11
14 lines
1556 bytes
"Jonathan Benedicto" <incorrect@no.server> wrote in message
news:42eaaae2$1@newsgroups.borland.com...

> 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
#3723
Author: Remy Lebeau (TeamB)
Date: Fri, 29 Jul 2005 23:12
14 lines
1394 bytes
"Jonathan Benedicto" <incorrect@no.server> wrote in message
news:42eab2df@newsgroups.borland.com...

> 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
#3724
Author: Jonathan Benedicto
Date: Fri, 29 Jul 2005 23:58
18 lines
1650 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:42eab88b@newsgroups.borland.com...
> 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
#3725
Author: Remy Lebeau (TeamB)
Date: Sat, 30 Jul 2005 00:51
12 lines
1309 bytes
"Jonathan Benedicto" <incorrect@no.server> wrote in message
news:42eac28d$1@newsgroups.borland.com...

> 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
#3626
Author: Jonathan Benedicto
Date: Sat, 30 Jul 2005 01:41
8 lines
1405 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:42ead130$1@newsgroups.borland.com...
> 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
#3627
Author: Nelson Altimari
Date: Sat, 30 Jul 2005 12:56
7 lines
1365 bytes
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
#3628
Author: Sergey Muschin
Date: Sat, 30 Jul 2005 16:39
10 lines
1248 bytes
This seem to be working... :)

Thank You

> #include <winsock2.h>
> #include <vcl.h>
>
> Jonathan
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads