Error Using irrNet

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
patrickniceboy
Posts: 23
Joined: Fri Apr 27, 2007 3:22 pm
Location: Brazil

Error Using irrNet

Post by patrickniceboy »

i want to use irrNet, i putted in my code this lines :

#pragma comment(lib, "ws2_32.lib")
#include <irrNet.h>

and all includes files from irrNet and im getting this errors:

Code: Select all


e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(112) : error C2011: 'fd_set' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(54) : see declaration of 'fd_set'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(147) : warning C4005: 'FD_SET' : macro redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(88) : see previous definition of 'FD_SET'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(156) : error C2011: 'timeval' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(97) : see declaration of 'timeval'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(212) : error C2011: 'hostent' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(153) : see declaration of 'hostent'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(225) : error C2011: 'netent' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(166) : see declaration of 'netent'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(232) : error C2011: 'servent' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(173) : see declaration of 'servent'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(244) : error C2011: 'protoent' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(185) : see declaration of 'protoent'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(400) : error C2011: 'sockaddr_in' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(321) : see declaration of 'sockaddr_in'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(410) : error C2011: 'WSAData' : 'struct' type redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(331) : see declaration of 'WSAData'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(470) : warning C4005: 'SO_DONTLINGER' : macro redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(411) : see previous definition of 'SO_DONTLINGER'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(527) : warning C4005: 'AF_IPX' : macro redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(469) : see previous definition of 'AF_IPX'
e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(555) : warning C4005: 'AF_MAX' : macro redefinition
        e:\arquivos de programas\microsoft visual studio 8\vc\platformsdk\include\winsock.h(488) : see previous definition of 'AF_MAX'
....
....
....
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

All hail Microsoft! You have to include winsock2.h before windows.h. Try putting <irrNet.h> as the first include in your .cpp file.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
patrickniceboy
Posts: 23
Joined: Fri Apr 27, 2007 3:22 pm
Location: Brazil

Post by patrickniceboy »

ok, but now i have link error

im using this sequence

Code: Select all

#include "stdafx.h"
#include <irrlicht.h>
#include <irrNet.h>
#include <irrKlang.h>
#include <iostream>
#include <windows.h>

#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib, "irrKlang.lib")
Error:

Code: Select all

Ziron.obj : error LNK2019: unresolved external symbol "public: __thiscall irr::net::INetManager::INetManager(class irr::IrrlichtDevice *)" (??0INetManager@net@irr@@QAE@PAVIrrlichtDevice@2@@Z) referenced in function "void __cdecl Setup(void)" (?Setup@@YAXXZ)
Tekk
Posts: 9
Joined: Sun Dec 16, 2007 4:25 pm

Post by Tekk »

Go to the project menu, hit settings, go to the link tab, and add wsock32.lib and ws2_32.lib to the end of the "project options" list.

(thats for VS6, don't know if its different in newer ones)
Tekk
Posts: 9
Joined: Sun Dec 16, 2007 4:25 pm

Post by Tekk »

oh nevermind, you're already doing that with the pragma stuff.

(sorry for the double post)
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Does irrNet have a .lib file that you need to link with? Sorry, I don't use it, I'm just guessing.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

The only obvious thing is that you are not linking to Enet. This can be achieved by adding all of the C files to your project.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply