Error LNK2019: solution to the problem of external symbols that cannot be parsed

Source: Internet
Author: User

Compiling...
1> ipv42.166traceroutesrc. cpp
1> d: \ graduate student \ c ++ \ study \ test \ 42443796traceroutesrc. cpp (461): warning C4267: "parameter": Converting from "size_t" to "DWORD" may cause data loss
1> d: \ graduate student \ c ++ \ study \ test \ 42443796traceroutesrc. cpp (1131): warning C4267: "parameter": Converting from "size_t" to "int", data may be lost
1> d: \ graduate student \ c ++ \ study \ test \ 42443796traceroutesrc. cpp (1167): warning C4267: "parameter": Converting from "size_t" to "int", data may be lost
1> d: \ graduate student \ c ++ \ study \ test \ 42443796traceroutesrc. cpp (1201): warning C4267: "parameter": Converting from "size_t" to "int", data may be lost
1> link...
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ WSASetLastError @ 4. This symbol is referenced in function _ WspiapiGetNameInfo @ 28
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ inet_ntoa @ 4. This symbol is referenced in function _ WspiapiLegacyGetAddrInfo @ 16
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ inet_ntoa @ 4
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ htonl @ 4. This symbol is referenced in function _ WspiapiLegacyGetAddrInfo @ 16
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ htonl @ 4
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ getservbyname @ 8. This symbol is referenced in function _ WspiapiLegacyGetAddrInfo @ 16
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ getservbyname @ 8
1> resolve. obj: error LNK2019: the external symbol _ imp _ htons @ 4 that cannot be parsed. This symbol is referenced in function _ WspiapiLegacyGetAddrInfo @ 16.
1> ipv43796traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ htons @ 4
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ inet_addr @ 4. This symbol is referenced in function _ WspiapiParseV4Address @ 8
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ inet_addr @ 4
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ WSAGetLastError @ 0. This symbol is referenced in function _ WspiapiQueryDNS @ 24
1> listen 4ipv6traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ WSAGetLastError @ 0
1> resolve. obj: error LNK2019: the external symbol _ imp _ gethostbyname @ 4 that cannot be parsed. This symbol is referenced in function _ WspiapiQueryDNS @ 24.
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ gethostbyname @ 4
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ gethostbyaddr @ 12, which is referenced in function _ WspiapiLegacyGetNameInfo @ 28
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ gethostbyaddr @ 12
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ getservbyport @ 8, which is referenced in function _ WspiapiLegacyGetNameInfo @ 28
1> ipv43166traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ getservbyport @ 8
1> resolve. obj: error LNK2019: external symbol that cannot be parsed _ imp _ ntohs @ 4. This symbol is referenced in function _ WspiapiLegacyGetNameInfo @ 28
1> ipv43796traceroutesrc. obj: error LNK2001: external symbol that cannot be parsed _ imp _ ntohs @ 4
1> route 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ WSAIoctl @ 36 that cannot be parsed. This symbol is used in the function "unsigned short _ cdecl computeicmp6pseudo headerchecksum (unsigned int, char *, int, struct addrinfo *)"(? Computeicmp6pseudo doheaderchecksum YAGIPADHPAUaddrinfo @ Z) is referenced
1> route 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ WSARecvFrom @ 36 that cannot be parsed. This symbol is used in the function "int _ cdecl PostRecvfrom (unsigned int, char *, int, struct sockaddr *, int *, struct _ OVERLAPPED *)"(? PostRecvfrom @ YAHIPADHPAUsockaddr @ PAHPAU_OVERLAPPED @ Z) is referenced
1> route 42.166traceroutesrc. obj: error LNK2019: external symbol that cannot be parsed _ imp _ setsockopt @ 20, which is in the function "int _ cdecl SetTtl (unsigned int, int )"(? SetTtl @ YAHIH @ Z) is referenced
1> 42.166traceroutesrc. obj: error LNK2019: external symbol that cannot be parsed _ imp _ WSACleanup @ 0, which is referenced in function _ main
1> 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ closesocket @ 4 that cannot be parsed. This symbol is referenced in function _ main.
1> 42.166traceroutesrc. obj: error LNK2019: external symbol that cannot be parsed _ imp _ WSAResetEvent @ 4, which is referenced in function _ main
1> 42.166traceroutesrc. obj: error LNK2019: external symbol that cannot be parsed _ imp _ WSAGetOverlappedResult @ 20, which is referenced in function _ main
1> 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ sendto @ 24 that cannot be parsed. This symbol is referenced in function _ main.
1> 42.166traceroutesrc. obj: error LNK2019: external symbol that cannot be parsed _ imp _ WSACreateEvent @ 0, which is referenced in function _ main
1> 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ bind @ 12 that cannot be parsed. This symbol is referenced in function _ main.
1> 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ socket @ 12 that cannot be parsed. This symbol is referenced in function _ main.
1> 42.166traceroutesrc. obj: error LNK2019: the external symbol _ imp _ WSAStartup @ 8 that cannot be parsed. This symbol is referenced in function _ main.
1> D: \ graduate student \ C ++ \ study \ test \ Debug \ test.exe: fatal error LNK1120: 23 External commands that cannot be parsed
1> the generated logs are stored in "file: // d: \ graduate student \ C ++ \ study \ test \ Debug \ BuildLog.htm"
1> test-34 errors and 4 warnings
============ Generation: 0 succeeded, 1 failed, 0 latest, 0 skipped ==========

Solution: Add # pragma comment (lib, "ws2_32.lib") after the cpp file Include ")

# Include "***"

# Pragma comment (lib, "ws2_32.lib ")

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.