954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

unresolved external symbol "a whole bunch of em"

Hey everyone, I'm working on my first program using "Winsock2.h".

I'm getting back linker errors "error LNK2001: unresolved external symbol ..."
9 unresolved externals total

The program came from an MSDN tutorial: "A simple winsock program", its a simple ping program that sends packets to a loopback address.

when I include winsock2.h I use

#include <stdio.h>         // for printf
#include "winsock2.h"


I'm sure its got something to do with define, but I've never worked with that in my programs before. If someone can point me to a tutorial, I'd be very happy. Thanks for viewing.

Geek-Master
Junior Poster
158 posts since Dec 2004
Reputation Points: 12
Solved Threads: 7
 

Did you link to wsock32.lib?

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

I googled for how to link a library and haven't found anything yet.
I'm using Visual Studio .NET for my C++ compiler. Some webpages that google turned up say that you can go into "Project" --> "Settings" --> "Linker" but there isn't a tab for settings under "Project". I guess thats a 6.0 thing and not a .NET thing.

I will be searching and google'n some more on how to link. I will also be checking up on here every now and then if you, Narue, have any info on how to link using .NET. Thanks for the help.

Geek-Master
Junior Poster
158 posts since Dec 2004
Reputation Points: 12
Solved Threads: 7
 

I searched on how to link Wsock32.LIB and found out how.

#include <stdio.h>        // for printf
#include "winsock2.h"

#pragma comment( lib, "wsock32.lib" )     // This will link to wsock32.lib

void main()
{
       // Winsock stuff
}


I just typed in that little line and bam... everything a...o...k.

Geek-Master
Junior Poster
158 posts since Dec 2004
Reputation Points: 12
Solved Threads: 7
 
shijobaby
Newbie Poster
14 posts since Jul 2009
Reputation Points: 4
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You