473,382 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Lnk2001 unresolved external symbols when calling socket functions

I need a hand with some stubborn link errors.

I'm trying to recreate and old program from 6.0 into .NET, but for some reason when I try to compile I'm getting linking errors for all my function calls that deal with sockets. I've included <winsock2.h> in stdafx.h and I linked to ws2_32.lib by going to project properties->linker->general->additional library directories and typing in ws2_32.lib.

Am I missing some include files or have the wrong library or something to that extent? Perhaps I put the link to the library in the wrong spot in properties or I need to put it in my code somewhere as well. Any feedback would be greatly appreciatted. I'm pasting the errors below.

Thanks,
-Ryan

Linking...
iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall closesocket(unsigned int)" (?closesocket@@$$J14YGHI@Z)

iotake3.obj : error LNK2001: unresolved external symbol "unsigned short __stdcall ntohs(unsigned short)" (?ntohs@@$$J14YGGG@Z)

iotake3.obj : error LNK2001: unresolved external symbol "unsigned long __stdcall ntohl(unsigned long)" (?ntohl@@$$J14YGKK@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall ioctlsocket(unsigned int,long,unsigned long *)" (?ioctlsocket@@$$J212YGHIJPAK@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall recv(unsigned int,char *,int,int)" (?recv@@$$J216YGHIPADHH@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall connect(unsigned int,struct sockaddr const *,int)" (?connect@@$$J212YGHIPBUsockaddr@@H@Z)

iotake3.obj : error LNK2001: unresolved external symbol "unsigned long __stdcall inet_addr(char const *)" (?inet_addr@@$$J14YGKPBD@Z)

iotake3.obj : error LNK2001: unresolved external symbol "unsigned short
__stdcall htons(unsigned short)" (?htons@@$$J14YGGG@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall setsockopt(unsigned int,int,int,char const *,int)" (?setsockopt@@$$J220YGHIHHPBDH@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall WSAGetLastError(void)" (?WSAGetLastError@@$$J10YGHXZ)

iotake3.obj : error LNK2001: unresolved external symbol "unsigned int __stdcall socket(int,int,int)" (?socket@@$$J212YGIHHH@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall WSAStartup(unsigned short,struct WSAData *)" (?WSAStartup@@$$J18YGHGPAUWSAData@@@Z)

iotake3.obj : error LNK2001: unresolved external symbol "unsigned long __stdcall htonl(unsigned long)" (?htonl@@$$J14YGKK@Z)

iotake3.obj : error LNK2001: unresolved external symbol "int __stdcall send(unsigned int,char const *,int,int)" (?send@@$$J216YGHIPBDHH@Z)

C:\Documents and Settings\rmay\My Documents\Visual Studio Projects\iotake3\Debug\iotake3.exe : fatal error LNK1120: 14 unresolved externals
Mar 7 '07 #1
2 7121
After a whole lot more searching and trial and error I solved the problem. Turns out I was adding ws2_32.lib in the wrong spot. What I needed to do was go to project properties->linker->Input->Additional Dependancies and add the library there. Hopefully this will help someone else in need.

-Ryan
Mar 9 '07 #2
kenobewan
4,871 Expert 4TB
Nice job Ryan, thanks for sharing the solution :).
Mar 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Bil Muh | last post by:
Hello Developers, I use VC++ .NET v2003. By using Windows Forms .NET, I am developing an application which will work with TCP/IP functions. I can Build my application in Debug Mode normally, but,...
3
by: We need more power captain | last post by:
Hi, I know less than a noob, I've been asked to do some compiles in VC++ 6 without knowing too much at all. (I'm a COBOL program normally so this is all too much for me) I open VC++6, open...
2
by: ozgan.net | last post by:
Hi everyone, I created my first COM object, but I took below errors. Why I didn't use socket functions. I defined *.def file __imp__WSAStartup@8 PRIVATE __imp__socket@12 PRIVATE...
2
by: Ian Taite | last post by:
Help, I am trying to nail a linking problem, to avoid having to lose about 2 weeks work. I have a backup of my project that compiles and links OK however changes I made sometime since then have...
5
by: eberesche | last post by:
Hello, as a novice in ASN.1 I have me to a project in C ++ under use of ASN.1 - structures risquély. One of my colleagues means, this would deal something with masochism ;-). Result should be a DLL...
2
by: Angus | last post by:
Hello I am using some classes from a third party and have included them in my projecxt and am compiling and linking with them. Everything compiles ok but I get these link errors: I added...
5
by: bonnielym84 | last post by:
Im new here..didnt noe whether is this the rite way to post my problem..Really need help here..i've been stucked in this error from last wk..My problem is like this..Im using VC++ 6.0 to compile my C...
1
by: mahricky | last post by:
i have the following error msg when i buid one of my cpp projects in visual studio 6. pls help me, it's very urgent. extures.obj : error LNK2001: unresolved external symbol "public: __thiscall...
0
by: Ryan Gaffuri | last post by:
hlink72@hotmail.com (Eric) wrote in message news:<ab8d8b14.0308220550.54fb5f22@posting.google.com>... LNK1120 is a standard C++ error. you using Visual C++? Means your references a class that...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.