Re: [Dev-C++] Linking error (help please!)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Kevin W. <ke...@me...> - 2001-11-18 18:22:44
|
Try including winsock2.h instead of winsock.h
Kev.
----- Original Message -----
From: Flávio de Souza <fla...@se...>
To: <dev...@li...>
Sent: Saturday, November 17, 2001 6:36 PM
Subject: [Dev-C++] Linking error (help please!)
> Hi !
>
> I am trying to compile and linking this simple code:
>
> #include <winsock.h> // winsock.h always needs to be included
> #include <stdio.h>
> #include <windows.h>
>
> //Prototypen
> int startWinsock(void);
>
> int main(int argc, char *argv[])
> {
> long rc;
> rc=startWinsock();
> if(rc!=0)
> {
> printf("Error: startWinsock, error code: %d\n",rc);
> return 1;
> }
> else
> {
> printf("Winsock started!\n");
> }
> return 0;
> }
>
> int startWinsock(void)
> {
> WSADATA wsa;
> return WSAStartup(MAKEWORD(1,1),&wsa);
> }
>
>
> But I got this error:
>
> c:\meus documentos\projetos\sistema de
>
e-mails\source\socketconnection\socket_test\socket_t2.o(.text+0xad):socket_t
2.cpp:
> undefined reference to `WSAStartup@8'
>
> I don't know what causes this, do you have any ideas?
>
> Probably it is a silly error.
>
> Tks,
>
> Flavio.
> Flavio de Souza
> fla...@ne...
> ICQ:78458203
>
----------------------------------------------------------------------------
----
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
>
|