irrnetlite probs - winsock dosent like me
irrnetlite probs - winsock dosent like me
Elp, iv added irrnet and enet to my project and all is fine except for when i include irrnet.h or enet.h i get loads of errors from winsock, they are all similar heres a sample -
winsock2.h(212) : error C2011: 'hostent' : 'struct' type redefinition
There are ones about macro and function redefinition aswell.
How can i stop this from happening?
Im using visual studio 2005
winsock2.h(212) : error C2011: 'hostent' : 'struct' type redefinition
There are ones about macro and function redefinition aswell.
How can i stop this from happening?
Im using visual studio 2005
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
I'm really not an expert (C++ and winsock), but this message seem to indicate that one of your include is redefining the same STRUCT structure block again. Check for a duplicate name somewhere in your code to see if that's true. (duplicate STRUCT block definition)
Perhaps you put the same include somewhere in your code...
Perhaps you put the same include somewhere in your code...
maybe you don't use guard blocks in your header files ???
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
These things are called include guards.
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
randomMesh wrote:These things are called include guards.
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: irrnetlite probs - winsock dosent like me
This is actually a classic Microsoft snafu. If you compile windows.h - by which I mean include it directly or include anything that includes it - before winsock2.h, then it explodes spectacularly. You have to ensure that you include winsock2.h before anything that includes windows.hortsa wrote:Elp, iv added irrnet and enet to my project and all is fine except for when i include irrnet.h or enet.h i get loads of errors from winsock, they are all similar heres a sample -
winsock2.h(212) : error C2011: 'hostent' : 'struct' type redefinition
Suck it and see.
Code: Select all
#include <windows.h>
#include <winsock2.h> // ASSPLOSION!
void main(void) { }
Code: Select all
#include <winsock2.h> // Works...
#include <windows.h> // ...fine
void main(void) { }
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: irrnetlite probs - winsock dosent like me
OMG! main() returns an int.rogerborg wrote:Code: Select all
void main(void) { }
-
- Posts: 368
- Joined: Tue Aug 21, 2007 1:43 am
- Location: The Middle of Nowhere
Code: Select all
void main()
Code: Select all
int|void main(int argc, char *argv[]) { }
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
No, no, no!. A C99 standard compliant compiler could show undefined behaviour. Never ever use void main()!Dark_Kilauea wrote:Is a perfectly valid definition of main. The majority of C/C++ compilers will accept it, making it a kind of de facto standard.Code: Select all
void main()