Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to use IcmpCreateFile();

How to use IcmpCreateFile();

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelptutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Manmohan29
    wrote on last edited by
    #1

    I got this error while building the project. I have included all header files but still this error remains???:confused: 1>Ping.obj : error LNK2019: unresolved external symbol _IcmpCreateFile@0 referenced in function "public: int __thiscall CPing::PingThis(class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?PingThis@CPing@@QAEHV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) 1>F:\Manmohan\Visual C++\IPM\Debug\IPM.exe : fatal error LNK1120: 1 unresolved externals

    // Ping.cpp
    // This is a custom c++ class added to the project
    #include "StdAfx.h"

    #include <IPHlpApi.h>
    #include <IcmpAPI.h>
    #include "Ping.h"

    CPing::CPing(void)
    {
    }

    CPing::~CPing(void)
    {
    }

    // Ping function
    int CPing::PingThis(CString m_sAddress)
    {
    HANDLE hIcmpFile = IcmpCreateFile();
    if (hIcmpFile == INVALID_HANDLE_VALUE)
    {
    return -1;
    }

    return 0;
    

    }

    Future Lies in Present. Manmohan Bishnoi

    D L 2 Replies Last reply
    0
    • M Manmohan29

      I got this error while building the project. I have included all header files but still this error remains???:confused: 1>Ping.obj : error LNK2019: unresolved external symbol _IcmpCreateFile@0 referenced in function "public: int __thiscall CPing::PingThis(class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?PingThis@CPing@@QAEHV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) 1>F:\Manmohan\Visual C++\IPM\Debug\IPM.exe : fatal error LNK1120: 1 unresolved externals

      // Ping.cpp
      // This is a custom c++ class added to the project
      #include "StdAfx.h"

      #include <IPHlpApi.h>
      #include <IcmpAPI.h>
      #include "Ping.h"

      CPing::CPing(void)
      {
      }

      CPing::~CPing(void)
      {
      }

      // Ping function
      int CPing::PingThis(CString m_sAddress)
      {
      HANDLE hIcmpFile = IcmpCreateFile();
      if (hIcmpFile == INVALID_HANDLE_VALUE)
      {
      return -1;
      }

      return 0;
      

      }

      Future Lies in Present. Manmohan Bishnoi

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Manmohan29 wrote:

      1>Ping.obj : error LNK2019: unresolved external symbol _IcmpCreateFile@0

      Does MSDN not work in your area? LNK2019 This is not the sort of question I'd expect from someone that is creating a multithreaded server application that uses sockets. :confused:

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      M 1 Reply Last reply
      0
      • M Manmohan29

        I got this error while building the project. I have included all header files but still this error remains???:confused: 1>Ping.obj : error LNK2019: unresolved external symbol _IcmpCreateFile@0 referenced in function "public: int __thiscall CPing::PingThis(class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?PingThis@CPing@@QAEHV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) 1>F:\Manmohan\Visual C++\IPM\Debug\IPM.exe : fatal error LNK1120: 1 unresolved externals

        // Ping.cpp
        // This is a custom c++ class added to the project
        #include "StdAfx.h"

        #include <IPHlpApi.h>
        #include <IcmpAPI.h>
        #include "Ping.h"

        CPing::CPing(void)
        {
        }

        CPing::~CPing(void)
        {
        }

        // Ping function
        int CPing::PingThis(CString m_sAddress)
        {
        HANDLE hIcmpFile = IcmpCreateFile();
        if (hIcmpFile == INVALID_HANDLE_VALUE)
        {
        return -1;
        }

        return 0;
        

        }

        Future Lies in Present. Manmohan Bishnoi

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Manmohan29 wrote:

        I have included all header files but still this error remains

        Thats because some header files [^] may not contain any source code. If you would have read the documentation for the IcmpCreateFile Function[^] you might have noticed it mentioning a Iphlpapi.lib file. One way of fixing this linker error is adding:#pragma comment(lib,"Iphlpapi.lib")
        You could also add the library to the Additional Dependencies section of your project. Best Wishes, -David Delaune

        M 1 Reply Last reply
        0
        • L Lost User

          Manmohan29 wrote:

          I have included all header files but still this error remains

          Thats because some header files [^] may not contain any source code. If you would have read the documentation for the IcmpCreateFile Function[^] you might have noticed it mentioning a Iphlpapi.lib file. One way of fixing this linker error is adding:#pragma comment(lib,"Iphlpapi.lib")
          You could also add the library to the Additional Dependencies section of your project. Best Wishes, -David Delaune

          M Offline
          M Offline
          Manmohan29
          wrote on last edited by
          #4

          thanks.

          Future Lies in Present. Manmohan Bishnoi

          1 Reply Last reply
          0
          • D David Crow

            Manmohan29 wrote:

            1>Ping.obj : error LNK2019: unresolved external symbol _IcmpCreateFile@0

            Does MSDN not work in your area? LNK2019 This is not the sort of question I'd expect from someone that is creating a multithreaded server application that uses sockets. :confused:

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            M Offline
            M Offline
            Manmohan29
            wrote on last edited by
            #5

            I have been given a project from my HOD(Head of Dept.) for a software which will list all the computers which are switched ON during class' time, because guys leave their systems running for downloading. This software will ping all the IP's of students and anyone's IP found working during class's time will be blocked for 2 days as a punishment. This software will also be having a module for serving files(articles, minor projects,...) of Electronics Dept. to the students. This I will complete with IOCP server. I wanted to do it multithreaded way also.(just for trying)

            Future Lies in Present. Manmohan Bishnoi

            D 1 Reply Last reply
            0
            • M Manmohan29

              I have been given a project from my HOD(Head of Dept.) for a software which will list all the computers which are switched ON during class' time, because guys leave their systems running for downloading. This software will ping all the IP's of students and anyone's IP found working during class's time will be blocked for 2 days as a punishment. This software will also be having a module for serving files(articles, minor projects,...) of Electronics Dept. to the students. This I will complete with IOCP server. I wanted to do it multithreaded way also.(just for trying)

              Future Lies in Present. Manmohan Bishnoi

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Manmohan29 wrote:

              ...all the computers which are switched ON during class' time...

              Are they connecting to a WAP that you have control over? If so, can you disable the WAP during class hours?

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups