473,385 Members | 1,292 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,385 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 7122
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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:
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.