Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Winsock help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Fri Jul 17, 2009 9:00 pm    Post subject: Winsock help Reply with quote

I've decided to learn winsock programming and I've already got a problem... I'm trying to compile an example code from msdn but I get this error
Code:
1>Main.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main
and I don't know what the error means Confused , I remember I tried winsock before and got the same error. Do I have to include any libraries or anything like that?

Source code:
Code:
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>

int main()
{
   WSADATA   wsaData;
   int      iResult;

   iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
   if(iResult != 0)
   {
      wprintf(L"WSAStartup failed: %d\n", iResult);
      return 1;
   }
   return 0;
}
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Fri Jul 17, 2009 9:03 pm    Post subject: Reply with quote

#pragma comment (lib, "Ws2_32.lib")

This should fix it.

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Jul 17, 2009 9:35 pm    Post subject: Re: Winsock help Reply with quote

TraxMate wrote:
Do I have to include any libraries or anything like that?


yes, MSDN tells you what you need.
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sat Jul 18, 2009 7:40 am    Post subject: Reply with quote

Thanks now it compiles Smile. Don't know how I missed the line telling me to link Ws2_32.lib...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites