-
April 26th, 2004, 05:59 PM
#1
Linker not finding socket functions?
I'm trying to Build a program that uses sockets to communicate with another program, but when I get to the link portion of the build, I get the following errors:
Code:
Linking...
BAESocket.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
BAESocket.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
BAESocket.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
BAESocket.obj : error LNK2001: unresolved external symbol __imp__socket@12
BAESocket.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
BAESocket.obj : error LNK2001: unresolved external symbol __imp__bind@12
BAESocket.obj : error LNK2001: unresolved external symbol __imp__listen@8
BAESocket.obj : error LNK2001: unresolved external symbol __imp__connect@12
BAESocket.obj : error LNK2001: unresolved external symbol __imp__accept@12
BAESocket.obj : error LNK2001: unresolved external symbol __imp__send@16
BAESocket.obj : error LNK2001: unresolved external symbol __imp__select@20
BAESocket.obj : error LNK2001: unresolved external symbol __imp__recv@16
BAESocket.obj : error LNK2001: unresolved external symbol __imp__sendto@24
BAESocket.obj : error LNK2001: unresolved external symbol __imp__recvfrom@24
BAESocket.obj : error LNK2001: unresolved external symbol __imp__getpeername@12
BAESocket.obj : error LNK2001: unresolved external symbol __imp__getsockname@12
BAESocket.obj : error LNK2001: unresolved external symbol __imp__htons@4
BAESocket.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
BAESocket.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
Debug/FTI_SCU.exe : fatal error LNK1120: 19 unresolved externals
Error executing link.exe.
My BAESocket class references the listed functions, minus the __imp__ (e.g., my function calls htons() vice __imp__htons()).
I've tried adding ws2_32.lib to the "additional library path" field in the Input Category of the Link Tab in Project Settings without luck.
What do I need to do to get my program to link?
------------------------------------------------------
There are only 10 types of people in the world.
Those who understand binary and those that don't.
-
April 26th, 2004, 06:07 PM
#2
You need to add it to the object/librarys modules entry, not the additional path, that is just a path setting for the above.
or use
#pragma comment(lib,"ws2_32")
in code.
-
April 26th, 2004, 06:31 PM
#3
Thank you. I thought I tried that before, but that was on something else, apparently.
------------------------------------------------------
There are only 10 types of people in the world.
Those who understand binary and those that don't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|