Hi,
I'm having trouble getting this linker bug to go away.
I have 2 files: Socket.cpp and Socket.h. I know that these files are legitamite because my professor gave them to me during last semester.

When I remove socket.cpp, everything compiles just fine. But with Socket.cpp, I get these errors.

__________________________________________________ _____________
Error 16 error LNK2001: unresolved external symbol ___WSAFDIsSet@8 socket.obj
Error 11 error LNK2001: unresolved external symbol __imp__accept@12 socket.obj
Error 9 error LNK2001: unresolved external symbol __imp__bind@12 socket.obj
Error 4 error LNK2001: unresolved external symbol __imp__closesocket@4 socket.obj
Error 14 error LNK2001: unresolved external symbol __imp__connect@12 socket.obj
Error 13 error LNK2001: unresolved external symbol __imp__gethostbyname@4 socket.obj
Error 8 error LNK2001: unresolved external symbol __imp__htons@4 socket.obj
Error 5 error LNK2001: unresolved external symbol __imp__ioctlsocket@12 socket.obj
Error 10 error LNK2001: unresolved external symbol __imp__listen@8 socket.obj
Error 6 error LNK2001: unresolved external symbol __imp__recv@16 socket.obj
Error 15 error LNK2001: unresolved external symbol __imp__select@20 socket.obj
Error 7 error LNK2001: unresolved external symbol __imp__send@16 socket.obj
Error 3 error LNK2001: unresolved external symbol __imp__socket@12 socket.obj
Error 2 error LNK2001: unresolved external symbol __imp__WSACleanup@0 socket.obj
Error 12 error LNK2001: unresolved external symbol __imp__WSAGetLastError@0 socket.obj
Error 1 error LNK2001: unresolved external symbol __imp__WSAStartup@8 socket.obj
Error 17 fatal error LNK1120: 16 unresolved externals C:\Users\Ben\Desktop\Documents\Visual Studio 2008\Projects\ConnectionDLL2\Release\ConnectionDLL 2.dll
-----------------------------------------------------------------------------------------------------

Socket.h includes
#include <WinSocket.h>
#include <string>
#include "ConnectionDLL2.h"


Socket.cpp includes...
#include "stdafx.h"
--> Which includes
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <string>
#include <list>
#include <map>
#include <algorithm>
#include <queue>
#include <process.h>
#include <strstream>
using namespace std;
#include "Socket.h"


Note: I'm using Visual C++ 2008

Thanks

~Ben S.

Recommended Answers

All 4 Replies

Hey. So I figured it out and it was pretty basic.
All I needed to do was include "ws2_32.lib", I did this
through the code: #pragma comment(lib, "ws2_32.lib").
|
Can anyone tell me what \-> comment does? Does it simply include the library during compile-time?

Thanks.

|
Can anyone tell me what \-> comment does? Does it simply include the library during compile-time?

Thanks.

read this

Thanks

boss boss thank u so much boss i won't forget ur help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.