473,756 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error LNK2019: unresolved external symbol

5 New Member
Hi all,
I'm new to VS, and I'm using Visual Studio .NET 2003.

I'm trying to write a program which uses pcap libraries. However, I keep getting the following errors:

error LNK2019: unresolved external symbol __imp__inet_nto a@4 referenced in function _got_packet
error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function _got_packet
error LNK2019: unresolved external symbol _Search referenced in function _got_packet
error LNK2019: unresolved external symbol _memcpy_s referenced in function _got_packet

The function got_packet is implemented in A.c, and the function Search is implemented in B.c. I also have corresponding header files A.h and B.h.

A.h looks somewhat like this (irrelevant code removed):

Expand|Select|Wrap|Line Numbers
  1. #ifndef A_H
  2. #define A_H
  3.  
  4. #include <WinSock2.h>
  5. #include <windows.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <pcap.h>
  9. #include <string.h>
  10. #include <strsafe.h>
  11.  
  12. #include "B.h"
  13.  
  14. void got_packet(u_char *user, const struct pcap_pkthdr *header, const u_char *packet);
  15.  
  16. #endif /* A_H */
B.h looks somewhat like this (irrelevant code removed):

Expand|Select|Wrap|Line Numbers
  1. #ifndef B_H
  2. #define B_H
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7.  
  8. __inline int Search( /* Function parameters */ );
  9.  
  10. #endif /* B_H */
Why am I getting these errors and how can I solve them?

Thank you!

Regards,
Rayne
Nov 25 '09 #1
2 11484
gpraghuram
1,275 Recognized Expert Top Contributor
I think you havent included the winsock library in linker options.
Try to include winsock and winsock (libraries) and i think the issue will get resolved.


Raghu
Nov 25 '09 #2
hjazz
5 New Member
Thanks. I added ws2_32.lib and took out the __inline from my Search function, and the program ran successfully.
Nov 26 '09 #3

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

Similar topics

0
1411
by: Jennifer | last post by:
Could you please report the following problem to your VC customer support? THANKS! Jennifer The problem is specific to the VC.Net and VC.Net 2003 <xlocinfo> headers. The problem is that if you look inside the _Locinfo::_Getdateorder() function definition, there is a call to a global _Getdateorder() function. This function has a prototype as being declared as an extern "C" dllimport function.
2
6394
by: AS | last post by:
Hi, I'm trying to use some power management features with windows 2000 Professional and I have visual studio .net 2003 installed with the latest service packs and everything... I want to write a simple app to turn the system into sleep mode/suspend mode. As per documentation of ACPI, you can use the power options by including the Powrprof.h file and use the Powrprof.lib file in your project, which I did, but when I build, it compiles...
0
5208
by: drumdawg21 | last post by:
Ive been working on this problem for a long time now and really need some help. I have a program in c++ code that gives me build errors and my program is having problems. I have two source files in my project and a header file. The header file(.h) contains the class, there is a main.cpp which contains the main part of the program and another .cpp file which contains the member functions of the class My problem is that when i create a project...
3
5849
by: YAN KANG / SU | last post by:
Hi, All I am migrating to Studio .NET 2003 from Studio 6.0 and Studio .NET 2002. When I compiled my code, which is compilable both in VC++ 6.0 and Studio .NET 2002, I have an error LNK2019 as the following ------------------------------------------------------------------------- error LNK2019: unresolved external symbol "class CPV3<double> __cdecl operator*(double,class CPV3<double> const &)" (??D@YA?AV?$CPV3@N@@NABV0@@Z) referenced in...
8
13689
by: Bruce Schechter | last post by:
I am quite experienced with vs.net 2003 and c# but fairly new to c++. I have a test app in c++ that I need to compile for a c#/c++ interop evaluation I'm doing. But first, I simply need to compile some straightforward, non-managed, console based c++ code. I created a win32 console c++ project. Then I added several "existing" c++ .cpp and .h files. When I try to compile, I get this error...
4
2799
by: naveenadevi | last post by:
Hi, I'm trying to use some power management features with windowsx xp and I have visual studio .net 2003 installed. As per documentation of ACPI, you can use the power options by including the Powrprof.h file and use the Powrprof.lib file in your project, which I did, but when I build, it compiles fine but I get this Link error.. :
3
9370
by: NewsGroup | last post by:
Hello, I am trying to write a code to interface with ILOG OPL development studio using their C++ libraries and header files. But I am encountering linker issues, an example being - error LNK2019: unresolved external symbol "public: void __thiscall IloOplModelI::printSolution(class std::basic_ostream<char,struct std::char_traits<char &,long)" (?printSolution@IloOplModelI@@QAEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@J@Z)
2
5331
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
2
5841
by: Rafael Douglas | last post by:
Hello All, I was writing a program and ran across this error: error LNK2019: unresolved external symbol "double __cdecl setTotalCost(void)" (?setTotalCost@@YANXZ) referenced in function _main 1>c:\users\rafael jr\documents\visual studio 2010\Projects\Inventory CS226\Debug\Inventory CS226.exe : fatal error LNK1120: 1 unresolved externals Can anyone please tell me where my error is or what i'm doing wrong? here is my code:
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10014
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2647
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.