NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
ismaelcramos
Joined: 07 Mar 2010 Posts: 1 Location: Brasil
|
Posted: Sun Mar 07, 2010 1:52 pm Post subject: Undefined reference to `WSAStartup´ |
|
|
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
|
Posted: Thu Nov 18, 2010 11:37 pm Post subject: |
|
|
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
|
Posted: Sun Nov 27, 2011 2:01 am Post subject: |
|
|
| Thanks. Your response sure helped me out a lot!! |
|
| Back to top |
|
 |
|
|
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
|
|