Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C / C++ (WinAPI, Konsole) » Linkererror bei Winsocks

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
13.09.2003, 14:45 Uhr
niels_ole_salscheider



Hallo,
wenn ich mein Programm (in VC++ b.NET) (compilieren + )linken will, wird folgender Fehler ausgegeben:

Zitat:
error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)


Das ist der bisherige Code:

Code:
//Winsock starten:
         if (iError = WSAStartup (MAKEWORD(2,0), &WSAData))
         {
             WCHAR winsockerror[100];
             LoadString ((HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), IDS_WINSOCKERROR, winsockerror, 100);
             MessageBox(hwnd, (LPCWSTR) wsprintf(winsockerror, (LPCWSTR) iError), szAppName, MB_ICONERROR);
             break;
         }

         //Socket erstellen:
         s=socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
         if(s==INVALID_SOCKET)
         {
             WCHAR socketerror[100];
             LoadString ((HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), IDS_SOCKETERROR, socketerror, 100);
             MessageBox(hwnd, (LPCWSTR) wsprintf(socketerror, (LPCWSTR) WSAGetLastError()), szAppName, MB_ICONERROR);
             break;
         }


Was hab' ich falsch gemacht?

Danke

Ole

PS: Tschuldigung, wenn das hier nicht 100% rein passt, aber ich war mir unsicher, wo ich es hinschreiben soll...

Dieser Post wurde am 13.09.2003 um 14:45 Uhr von niels_ole_salscheider editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
001
13.09.2003, 15:01 Uhr
Uwe
C/C++ Master
(Administrator)


Hallo,
ws2_32.lib mit gelinkt?
--
"Es ist schwierig, ein Programm wirklich idiotensicher zu machen, weil Idioten so genial sind."

Bis dann...
Uwe
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
002
13.09.2003, 15:28 Uhr
niels_ole_salscheider



Stimmt, hab das #include <winsock2.h> vergessen; aber jetzt bekomme ich zig Fehlermeldungen, die wohl nichts mit meinem Prog., sondern der Include-Datei zu tun haben:


Zitat:

D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2536): error C2375: 'WSAAsyncSelect' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2516): error C2375: 'WSACancelAsyncRequest' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2493): error C2375: 'WSAAsyncGetHostByAddr' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2466): error C2375: 'WSAAsyncGetHostByName' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2441): error C2375: 'WSAAsyncGetProtoByNumber' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2416): error C2375: 'WSAAsyncGetProtoByName' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2390): error C2375: 'WSAAsyncGetServByPort' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2363): error C2375: 'WSAAsyncGetServByName' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2341): error C2375: 'WSACancelBlockingCall' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2324): error C2375: 'WSASetBlockingHook' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2307): error C2375: 'WSAUnhookBlockingHook' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2290): error C2375: 'WSAIsBlocking' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2273): error C2375: 'WSAGetLastError' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2256): error C2375: 'WSASetLastError' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2239): error C2375: 'WSACleanup' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2221): error C2375: 'WSAStartup' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2201): error C2375: 'getprotobyname' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2184): error C2375: 'getprotobynumber' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2166): error C2375: 'getservbyname' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2147): error C2375: 'getservbyport' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2128): error C2375: 'gethostname' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2110): error C2375: 'gethostbyname' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2091): error C2375: 'gethostbyaddr' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2068): error C2375: 'socket' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2048): error C2375: 'shutdown' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2026): error C2375: 'setsockopt' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2000): error C2375: 'sendto' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1975): error C2375: 'send' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1951): error C2375: 'select' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1925): error C2375: 'recvfrom' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1900): error C2375: 'recv' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1880): error C2375: 'ntohs' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1863): error C2375: 'ntohl' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1845): error C2375: 'listen' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1827): error C2375: 'inet_ntoa' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1810): error C2375: 'inet_addr' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1793): error C2375: 'htons' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1776): error C2375: 'htonl' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1755): error C2375: 'getsockopt' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1732): error C2375: 'getsockname' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1711): error C2375: 'getpeername' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1690): error C2375: 'ioctlsocket' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1669): error C2375: 'connect' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1650): error C2375: 'closesocket' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1631): error C2375: 'bind' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(1610): error C2375: 'accept' : redefinition; different linkage
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(678): warning C4005: 'FD_CLOSE' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(675): warning C4005: 'FD_CONNECT' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(672): warning C4005: 'FD_ACCEPT' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(669): warning C4005: 'FD_OOB' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(666): warning C4005: 'FD_WRITE' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(663): warning C4005: 'FD_READ' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(638): warning C4005: 'SOMAXCONN' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(625): error C2011: 'linger' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(586): error C2011: 'sockproto' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(546): error C2011: 'sockaddr' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(540): warning C4005: 'AF_MAX' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(512): warning C4005: 'AF_IPX' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(455): warning C4005: 'SO_DONTLINGER' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(395): error C2011: 'WSAData' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(385): error C2011: 'sockaddr_in' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(327): error C2011: 'in_addr' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(241): error C2011: 'protoent' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(229): error C2011: 'servent' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(222): error C2011: 'netent' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(209): error C2011: 'hostent' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(153): error C2011: 'timeval' : 'struct' type redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(144): warning C4005: 'FD_SET' : macro redefinition
D:\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(109): error C2011: 'fd_set' : 'struct' type redefinition



Was soll ich jetzt tun?

Dieser Post wurde am 13.09.2003 um 15:28 Uhr von niels_ole_salscheider editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
003
13.09.2003, 15:38 Uhr
Uwe
C/C++ Master
(Administrator)


Hallo,
hmm... sieht nach Mehrfachbindung aus.
Hast Du die lib wirklich gelinkt? Z.B. im Quelltext mit

C++:
#pragma comment (lib,"ws2_32.lib")


--edit ; musste weg!
--
"Es ist schwierig, ein Programm wirklich idiotensicher zu machen, weil Idioten so genial sind."

Bis dann...
Uwe

Dieser Post wurde am 13.09.2003 um 15:39 Uhr von Uwe editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
004
13.09.2003, 15:53 Uhr
niels_ole_salscheider




Zitat:
Uwe postete

C++:
#pragma comment (lib,"ws2_32.lib")





Danke, jetzt klappt's! Ist meine erste Internet-Anwendung...

Dieser Post wurde am 13.09.2003 um 15:53 Uhr von niels_ole_salscheider editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ C / C++ (WinAPI, Konsole) ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: