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. Managed C++/CLI
  4. LNK2019: unresolved external

LNK2019: unresolved external

Scheduled Pinned Locked Moved Managed C++/CLI
c++helpquestion
9 Posts 3 Posters 7 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???

    L F W 3 Replies Last reply
    0
    • L Lost User

      int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???

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

      af00001 wrote:

      it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???

      The .h files do not get actioned by the build system or compiler, only insofar as they are included into the source via the .cpp files. The compiler will only get executed to convert a .cpp file (and its inclusions) into object code.

      Veni, vidi, abiit domum

      L 1 Reply Last reply
      0
      • L Lost User

        int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???

        F Offline
        F Offline
        Freak30
        wrote on last edited by
        #3

        This looks more like unmanaged C++ than managed. You need to include the .lib file of the dll the function resides in into the linker input of your application.

        The good thing about pessimism is, that you are always either right or pleasently surprised.

        L 2 Replies Last reply
        0
        • F Freak30

          This looks more like unmanaged C++ than managed. You need to include the .lib file of the dll the function resides in into the linker input of your application.

          The good thing about pessimism is, that you are always either right or pleasently surprised.

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

          Freak30 wrote:

          This looks more like unmanaged C++ than managed.

          Not at all. The key is that the code is contained within the header file, so why is the .cpp file necessary. That's the way C++/CLI is done.

          Veni, vidi, abiit domum

          L 1 Reply Last reply
          0
          • F Freak30

            This looks more like unmanaged C++ than managed. You need to include the .lib file of the dll the function resides in into the linker input of your application.

            The good thing about pessimism is, that you are always either right or pleasently surprised.

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

            thnx,,,,but i am not sure which lib needs to include :(

            1 Reply Last reply
            0
            • L Lost User

              Freak30 wrote:

              This looks more like unmanaged C++ than managed.

              Not at all. The key is that the code is contained within the header file, so why is the .cpp file necessary. That's the way C++/CLI is done.

              Veni, vidi, abiit domum

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

              thnx....ok

              1 Reply Last reply
              0
              • L Lost User

                af00001 wrote:

                it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???

                The .h files do not get actioned by the build system or compiler, only insofar as they are included into the source via the .cpp files. The compiler will only get executed to convert a .cpp file (and its inclusions) into object code.

                Veni, vidi, abiit domum

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

                thnx ok

                1 Reply Last reply
                0
                • L Lost User

                  int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???

                  W Offline
                  W Offline
                  WuRunZhe
                  wrote on last edited by
                  #8

                  Well, did you add DriverWork.cpp to your solution? Well, I was experienced problem like you. Cause of error is that I include header file using #include keyword but know added header and source file to my solutions. Whenever I've added it to my solutions, error disappeared. :cool:

                  L 1 Reply Last reply
                  0
                  • W WuRunZhe

                    Well, did you add DriverWork.cpp to your solution? Well, I was experienced problem like you. Cause of error is that I include header file using #include keyword but know added header and source file to my solutions. Whenever I've added it to my solutions, error disappeared. :cool:

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

                    thnx

                    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