| View previous topic :: View next topic |
| Author |
Message |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Wed Apr 30, 2008 10:33 pm Post subject: [Help] C++ Errors |
|
|
Im working on a project in C++ which has to do with Winsock2. I get the following errors:
| Code: | Packet.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
Packet.obj : error LNK2001: unresolved external symbol __imp__send@16
Packet.obj : error LNK2001: unresolved external symbol __imp__accept@12
Packet.obj : error LNK2001: unresolved external symbol __imp__listen@8
Packet.obj : error LNK2001: unresolved external symbol __imp__bind@12
Packet.obj : error LNK2001: unresolved external symbol __imp__htons@4
Packet.obj : error LNK2001: unresolved external symbol __imp__socket@12
Packet.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
Packet.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
Packet.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8 |
But im not sure what to do to fix them, can anyone help lead the way?  |
|
| Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Wed Apr 30, 2008 11:11 pm Post subject: |
|
|
missing lib?
________
justin bieber fan
Last edited by Bizarro on Tue Feb 01, 2011 11:59 am; edited 1 time in total |
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Wed Apr 30, 2008 11:11 pm Post subject: |
|
|
| I'm not sure which lib im missing. |
|
| Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Wed Apr 30, 2008 11:17 pm Post subject: |
|
|
did u include Winsock2.h?
Header Declared in Winsock2.h.
Library Use Ws2_32.lib.
DLL Requires Ws2_32.dll.
________
Atlantic
Last edited by Bizarro on Tue Feb 01, 2011 11:59 am; edited 1 time in total |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Apr 30, 2008 11:59 pm Post subject: |
|
|
| Bizarro wrote: | | Library Use Ws2_32.lib |
ding ding
Link against this.
for future reference, MSDN will tell you exactly what you need, so be sure to use it when in doubt. |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Thu May 01, 2008 1:37 am Post subject: |
|
|
| #pragma comment( lib, "ws2_32.lib" ) |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Thu May 01, 2008 9:24 am Post subject: |
|
|
Also make sure you read up about Winsock includes and libs, they must be included before you include windows.h
Some more info on the headers:
http://msdn.microsoft.com/en-us/library/ms737629(VS.85).aspx _________________
- Retired. |
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Thu May 01, 2008 5:35 pm Post subject: |
|
|
| NOZ THANK YOU!! |
|
| Back to top |
|
 |
Estx Expert Cheater
Reputation: 0
Joined: 04 Mar 2008 Posts: 172
|
Posted: Fri May 02, 2008 8:38 am Post subject: |
|
|
Lol that pissed me off when I was first writing detours for winsock, I was declaring includes for the libraries and headers after windows.h =\ hundreds of errors Figured it out after a short while though.
Come to think of it, I never finished the project.. I think it was crashing every time I injected, ended up making a proxy instead. Will have to revive that project and get it working.  |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Fri May 02, 2008 9:50 am Post subject: |
|
|
Yea when I was doing some random projects with it I ran into the issue too, looked up the funcs and found that article and was like "wow... so many errors for such a stupid reason.." Figured they would add a #ifdef block at the top of the winsock file to determine if windows.h was included already and just die on that. But no... _________________
- Retired. |
|
| Back to top |
|
 |
|