Error LNK2019: unresolved external symbol

Source: Internet
Author: User
Tags epoll

Recently in the attempt to communicate with the UDT, wrote two simple client and server, but the compile time appeared "error LNK2019: unresolved external symbols" error, in order to summarize later, or to record the solution.

1>------Started Build: Project: Udt_appserver, configuration: Debug Win32------
1> build Start time is 2013/11/11 20:53:08.
1>initializebuildstatus:
1> is creating "Debug\udt_appserver.unsuccessfulbuild" because "AlwaysCreate" is already specified.
1>clcompile:
1> Appserver.cpp
1>resourcecompile:
1> all outputs are up-to-date.
1>manifestresourcecompile:
1> all outputs are up-to-date.
1>api.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cudtunited::startup (void)" ([EMA Il protected]@ @QAEHXZ) are referenced in
1>channel.obj:error LNK2001: unresolved external symbols [email protected]
1>api.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cudtunited::startup (void)" ([EMA Il protected]@ @QAEHXZ) are referenced in
1>api.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cudtunited::cleanup (void)" ([EMA Il protected]@ @QAEHXZ) are referenced in
1>api.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cudtunited::bind (int,unsigned in T) "([email Protected]@@[email protected]) is referenced
1>channel.obj:error LNK2001: unresolved external symbols [email protected]
1>api.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Private:void __thiscall Cudtunited::updatemux (class CU Dtsocket *,struct sockaddr const *,unsigned INT const *) "([email protected]@@[email protected]@[email Protected]@[email p Rotected]) is referenced in
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:void __thiscall cchannel::open (struct Socka DDR const *) "([email protected]@@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:void __thiscall cchannel::open (struct Socka DDR const *) "([email protected]@@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:void __thiscall cchannel::open (struct Socka DDR const *) "([email protected]@@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:void __thiscall cchannel::open (struct Socka DDR const *) "([email protected]@@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Private:void __thiscall cchannel::setudpsockopt ( void) "([email protected]@ @AAEXXZ) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in function "Public:void __thiscall cchannel::close (void) const "([email protected]@ @QBEXXZ) is quoted
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cchannel::getsndbufsize ( void) "([email protected]@ @QAEHXZ) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:void __thiscall cchannel::getpeeraddr ( struct sockaddr *) const "([email protected]@@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cchannel::sendto (struct sock Addr Const *,class Cpacket &) const "([email protected]@@[email protected]@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cchannel::sendto (struct sock Addr Const *,class Cpacket &) const "([email protected]@@[email protected]@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cchannel::sendto (struct sock Addr Const *,class Cpacket &) const "([email protected]@@[email protected]@[email protected]@@z) is referenced
1>channel.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Public:int __thiscall cchannel::recvfrom (struct so Ckaddr *,class Cpacket &) const "([email protected]@@[email protected]@[email protected]@@z) is referenced
1>core.obj:error LNK2019: unresolved external symbol [email protected], the symbol in the function "Private:int __thiscall cudt::listen (struct sockaddr *, Class Cpacket &) "([email protected]@@[email protected]@[email protected]@@z) is referenced
1>epoll.obj:error LNK2019: unresolved external symbol [email protected], the symbol in function "Public:int __thiscall cepoll::wait (Int,class std::se T<int,struct std::less<int>,class std::allocator<int> > *,class std::set<int,struct std::less <int>,class std::allocator<int> > *,__int64,class std::set<unsigned int,struct std::less< unsigned int>,class std::allocator<unsigned int> > *,class std::set<unsigned int,struct std::less< unsigned int>,class std::allocator<unsigned int> > *) "(Email protected]@@[email protected][email Protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected ]@[email protected]@[email protected]@[email protected]@[email protected]@z) is referenced in
1>epoll.obj:error LNK2019: unresolved external symbol [email protected], the symbol in function "Public:int __thiscall cepoll::wait (Int,class std::se T<int,struct std::less<int>,class std::allocator<int> > *,class std::set<int,struct std::less <int>,class std::allocator<int> > *,__int64,class std::set<unsigned int,struct std::less< unsigned int>,class std::allocator<unsigned int> > *,class std::set<unsigned int,struct std::less< unsigned int>,class std::allocator<unsigned int> > *) "(Email protected]@@[email protected][email Protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected ]@[email protected]@[email protected]@[email protected]@[email protected]@z) is referenced in
1>f:\c_test\test_udt\debug\udt_appserver.exe:fatal error LNK1120:20 an unresolved external command
1>
1> build failed.
1>
1> used Time 00:00:01.05
========== Generation: Success 0, failure 1, latest 0, skip 0 ==========

Then the individual issues are positioned, and then manually add the individual. h files, found that the symptoms are not the root causes, finally found a solution:

#pragma comment (lib, "Ws2_32.lib")

That is, if you are writing a. cpp or a reference to an. h file, add the line above.
The previous meaning of this sentence is to statically add a Lib file


That is, the library file


The Ws2_32.lib file provides support for the following network-related APIs, and if you use the APIs, you should add Ws2_32.lib to the project (otherwise you will need to load ws2_32.dll dynamically).


This phrase usually appears in network programming, when you need to use the network API functions, you must use this statement to load the Ws2_32.lib library or dynamically load the Ws2_32.dll.

For the specific use of #pragma comment, please refer to the Baidu Encyclopedia: #pragma comment

Error LNK2019: unresolved external symbol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.