NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Undefined reference to `WSAStartup´

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
ismaelcramos



Joined: 07 Mar 2010
Posts: 1
Location: Brasil

PostPosted: Sun Mar 07, 2010 1:52 pm    Post subject: Undefined reference to `WSAStartup´ Reply with quote

I'm testing a Socket Client and Server C++ project in NetBeans and
when I try to build the code I always get the same awful error message:
main.cpp:10: undefined reference to `WSAStartup@8'

I've tried a lot of "includes" and the last one is just the one below:
#include "winsock2.h"

The executable code in main() that generates the error message is:

// Initialize Winsock.
WSADATA wsaData;
int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );

As I said I have tried a lot of options, finding for libs like Ws2_32.lib,
wsock32.lib or libws2_32.lib. But I really don't know how to do for solving this problem whith Netbeans.
Tks for any help.
Back to top
jsprenkle



Joined: 18 Nov 2010
Posts: 17

PostPosted: Thu Nov 18, 2010 11:37 pm    Post subject: Reply with quote

Go to your project properties.
in the Linker section hit the button for libraries.
hit the 'add library' button.
Add the library "ws2_32". Hit the open button (twice) to add the library.
Do the same again to add the library "wsock32".
Back to top
Golfnut



Joined: 30 Sep 2011
Posts: 3
Location: Anacortes, WA

PostPosted: Sun Nov 27, 2011 2:01 am    Post subject: Reply with quote

Thanks. Your response sure helped me out a lot!!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
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 can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo