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. help regarding inheritance

help regarding inheritance

Scheduled Pinned Locked Moved C / C++ / MFC
helpoopquestion
8 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.
  • U Offline
    U Offline
    Usman Arif
    wrote on last edited by
    #1

    HI all! I m calling a function by a pointer of an external class & that pointer has been defined in the parent class of the class from which the already specified function is being called. The pointer's class is linked with the parent class (through its header). So, the scenario is that a function accesses the protected member of a parent class (pointer) & then uses that member to call a function. Now, when i compile the code, LNK2001/LNK1120 error is thrown. Can any body tell me y this problem occured & what about its remedy? Regards Usman Arif Usman Arif

    C 1 Reply Last reply
    0
    • U Usman Arif

      HI all! I m calling a function by a pointer of an external class & that pointer has been defined in the parent class of the class from which the already specified function is being called. The pointer's class is linked with the parent class (through its header). So, the scenario is that a function accesses the protected member of a parent class (pointer) & then uses that member to call a function. Now, when i compile the code, LNK2001/LNK1120 error is thrown. Can any body tell me y this problem occured & what about its remedy? Regards Usman Arif Usman Arif

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      External as in not part of your project ? Have you linked to the appropriate .lib files ? Christian Graus - Microsoft MVP - C++

      U 1 Reply Last reply
      0
      • C Christian Graus

        External as in not part of your project ? Have you linked to the appropriate .lib files ? Christian Graus - Microsoft MVP - C++

        U Offline
        U Offline
        Usman Arif
        wrote on last edited by
        #3

        External means another application. infact, i m integrating the dll of my project in an application (external). Now, in the next step, i m trying to access a class from the external application. For this, i included the header in my project. It worked fine uptil now. But, when i try to access a function from that external class, the linking error was thrown. Usman Arif

        C T 2 Replies Last reply
        0
        • U Usman Arif

          External means another application. infact, i m integrating the dll of my project in an application (external). Now, in the next step, i m trying to access a class from the external application. For this, i included the header in my project. It worked fine uptil now. But, when i try to access a function from that external class, the linking error was thrown. Usman Arif

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          OK, so you need to take the .lib file from when you build that external dll, and link to it. Christian Graus - Microsoft MVP - C++

          1 Reply Last reply
          0
          • U Usman Arif

            External means another application. infact, i m integrating the dll of my project in an application (external). Now, in the next step, i m trying to access a class from the external application. For this, i included the header in my project. It worked fine uptil now. But, when i try to access a function from that external class, the linking error was thrown. Usman Arif

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #5

            Hello Mr arif, you misunderstood MR Graus. He is saying that you forget to include .lib file which contain the runtime symbol for you external class(i.e. class from DLL).

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta

            U 1 Reply Last reply
            0
            • T ThatsAlok

              Hello Mr arif, you misunderstood MR Graus. He is saying that you forget to include .lib file which contain the runtime symbol for you external class(i.e. class from DLL).

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta

              U Offline
              U Offline
              Usman Arif
              wrote on last edited by
              #6

              The external application, i m using, has an .exe file as its output file. I converted the output file to .lib file & then included it into my project, but the error is LNK1136 ,i.e. "Invalid or corrupt file". Usman Arif

              T 1 Reply Last reply
              0
              • U Usman Arif

                The external application, i m using, has an .exe file as its output file. I converted the output file to .lib file & then included it into my project, but the error is LNK1136 ,i.e. "Invalid or corrupt file". Usman Arif

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                Usman Arif wrote: The external application, i m using, has an .exe file as its output file. Buddy I am here talking about .LIB file which will produce with the DLL (when you build it). you can find that .lib in DEBUG/RELEASE folder of DLL project

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta

                U 1 Reply Last reply
                0
                • T ThatsAlok

                  Usman Arif wrote: The external application, i m using, has an .exe file as its output file. Buddy I am here talking about .LIB file which will produce with the DLL (when you build it). you can find that .lib in DEBUG/RELEASE folder of DLL project

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta

                  U Offline
                  U Offline
                  Usman Arif
                  wrote on last edited by
                  #8

                  Friend! That .lib file is already there, no problem with that. My problem is that i wanna access the external application's (in which .lib of my project was included already)function from my project. now, r u clear with my problem? if yes, suggest some remedy for it; if possible. Usman Arif

                  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