Problems with LNK2019

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • solarin

    #1

    Problems with LNK2019

    Im having several problems with the error LNK2019.

    I ve a class that derives from another:


    //controller.h

    #include MessagesNotifie r_Client

    class Controller : public MessagesNotifie r_Client
    {
    public:

    Controller();
    ~Controller();

    void TempVerificatio n(int a, int b);
    };


    //controller.cpp

    Controller::Con troller(){}
    Controller::~Co ntroller(){}

    void TempVerificatio n(int a, int b)
    {
    if ( abs(a - b) 23 ){
    NotifyWarningMe ssage("warning" );

    }



    NotifyWarningMe ssage is a method defined in MessagesNotifie r_Client.


    Im using Visual Studio .net 2003. and I have a Solution with 2
    projects. The controller class is in
    the project A, and the MessagesNotifie r_Client in project B:

    ===Solution "BigTest" (2 projects)
    == - A
    |
    ------ Controller.h
    ------ Controller.cpp
    == - B
    |
    ------ MessagesNotifie r_Client.cpp
    ------ MessagesNotifie r_Client.h



    Any ideas where is the problem, or how I should configure VisualStudio?


    Thanks for your support.

  • solarin

    #2
    Re: Problems with LNK2019


    solarin wrote:
    Im having several problems with the error LNK2019.
    >
    I ve a class that derives from another:
    >
    >
    //controller.h
    >
    #include MessagesNotifie r_Client
    >
    class Controller : public MessagesNotifie r_Client
    {
    public:
    >
    Controller();
    ~Controller();
    >
    void TempVerificatio n(int a, int b);
    };
    >
    >
    //controller.cpp
    >
    Controller::Con troller(){}
    Controller::~Co ntroller(){}
    >
    void TempVerificatio n(int a, int b)
    {
    if ( abs(a - b) 23 ){
    NotifyWarningMe ssage("warning" );
    >
    }
    >
    >
    >
    NotifyWarningMe ssage is a method defined in MessagesNotifie r_Client.
    >
    >
    Im using Visual Studio .net 2003. and I have a Solution with 2
    projects. The controller class is in
    the project A, and the MessagesNotifie r_Client in project B:
    >
    ===Solution "BigTest" (2 projects)
    == - A
    |
    ------ Controller.h
    ------ Controller.cpp
    == - B
    |
    ------ MessagesNotifie r_Client.cpp
    ------ MessagesNotifie r_Client.h
    >
    >
    >
    Any ideas where is the problem, or how I should configure VisualStudio?
    >
    >
    Thanks for your support.

    The line where LNK2019 apears is where NotifyWarningMe ssage method is
    called.

    Comment

    • Jerry Coffin

      #3
      Re: Problems with LNK2019

      In article <1155022028.046 177.209940@i42g 2000cwa.googleg roups.com>,
      en.navarro@gmai l.com says...

      [ ... ]
      class Controller : public MessagesNotifie r_Client
      [ ... ]
      void TempVerificatio n(int a, int b);
      Here you've declared a class member function.
      //controller.cpp
      [ ... ]
      void TempVerificatio n(int a, int b) {
      But here you're defining a free function. You almost certainly want this
      to be something like:

      void Controller::Tem pVerification(i nt a, int) {
      // ...

      --
      Later,
      Jerry.

      The universe is a figment of its own imagination.

      Comment

      • solarin

        #4
        Re: Problems with LNK2019


        Jerry Coffin ha escrito:
        You almost certainly want this
        to be something like:
        >
        void Controller::Tem pVerification(i nt a, int) {
        // ...
        >
        sorry , it was my mistake. The method is implemented as you mentioned:

        void Controller::Tem pVerification(i nt a, int b)
        {
        if ( abs(a - b) 23 ){
        NotifyWarningMe ssage("warning" ); // LNK2019 error here

        }

        The error is when i'm calling the method NotifyWarningMe ssage.

        Thanks.

        Comment

        • Ian Collins

          #5
          Re: Problems with LNK2019

          solarin wrote:
          Im having several problems with the error LNK2019.
          >
          What's one of those? Show the error message, 'LNK2019' means nothing to
          someone who doesn't use your tools.
          I ve a class that derives from another:
          >
          //controller.h
          >
          #include MessagesNotifie r_Client
          >
          class Controller : public MessagesNotifie r_Client
          {
          public:
          >
          Controller();
          ~Controller();
          >
          void TempVerificatio n(int a, int b);
          };
          >
          >
          //controller.cpp
          >
          Controller::Con troller(){}
          Controller::~Co ntroller(){}
          >
          void TempVerificatio n(int a, int b)
          {
          if ( abs(a - b) 23 ){
          NotifyWarningMe ssage("warning" );
          >
          }
          >
          NotifyWarningMe ssage is a method defined in MessagesNotifie r_Client.
          >
          You probably haven't linked the two compilation units to form your
          executable.

          --
          Ian Collins.

          Comment

          • solarin

            #6
            Re: Problems with LNK2019


            Ian Collins wrote:
            What's one of those? Show the error message, 'LNK2019' means nothing to
            someone who doesn't use your tools.
            Controller.obj : error LNK2019: símbolo externo "public: void
            __thiscall MessagesNotifie r_Client::Notif yWarningMessage (char const *)"
            (?NotifyWarning Message@Message sNotifier_Clien t@@QAEXPBD@Z) sin resolver
            al que se hace referencia en la función "public: void __thiscall
            Controller::Tem pVerification(i nt,int)"
            (?ComprobarPres ion@BometContro ller@@QAEXMM@Z)
            ...\..\..\..\.. \Bin\Win32\VC7\ Release/GMETEO-GestorMeteorolo gico.exe :
            fatal error LNK1120: 1 externos sin resolver

            simbolo externo = External Symbol
            sin resolver al que se hace referencia en la funcion = not resolved to
            that one refers in the function

            externos sin resolver = external not resolved

            Comment

            • Ian Collins

              #7
              Re: Problems with LNK2019

              solarin wrote:
              Ian Collins wrote:
              >
              >
              >>What's one of those? Show the error message, 'LNK2019' means nothing to
              >>someone who doesn't use your tools.
              >
              >
              Controller.obj : error LNK2019: símbolo externo "public: void
              __thiscall MessagesNotifie r_Client::Notif yWarningMessage (char const *)"
              (?NotifyWarning Message@Message sNotifier_Clien t@@QAEXPBD@Z) sin resolver
              al que se hace referencia en la función "public: void __thiscall
              Controller::Tem pVerification(i nt,int)"
              (?ComprobarPres ion@BometContro ller@@QAEXMM@Z)
              ..\..\..\..\..\ Bin\Win32\VC7\R elease/GMETEO-GestorMeteorolo gico.exe :
              fatal error LNK1120: 1 externos sin resolver
              >
              simbolo externo = External Symbol
              sin resolver al que se hace referencia en la funcion = not resolved to
              that one refers in the function
              >
              externos sin resolver = external not resolved
              >
              Sure looks like you haven't linked the two cpp files you mentioned to
              form your executable.

              How you do this is off topic here, you'll get more help on a windows
              programming group.

              --
              Ian Collins.

              Comment

              • RKS

                #8
                Re: Problems with LNK2019


                solarin wrote:
                Im having several problems with the error LNK2019.
                >
                I ve a class that derives from another:
                >
                >
                //controller.h
                >
                #include MessagesNotifie r_Client
                >
                class Controller : public MessagesNotifie r_Client
                {
                public:
                >
                Controller();
                ~Controller();
                >
                void TempVerificatio n(int a, int b);
                };
                >
                >
                //controller.cpp
                >
                Controller::Con troller(){}
                Controller::~Co ntroller(){}
                >
                void TempVerificatio n(int a, int b)
                {
                if ( abs(a - b) 23 ){
                NotifyWarningMe ssage("warning" );
                >
                }
                >
                >
                >
                NotifyWarningMe ssage is a method defined in MessagesNotifie r_Client.
                >
                >
                Im using Visual Studio .net 2003. and I have a Solution with 2
                projects. The controller class is in
                the project A, and the MessagesNotifie r_Client in project B:
                >
                ===Solution "BigTest" (2 projects)
                == - A
                |
                ------ Controller.h
                ------ Controller.cpp
                == - B
                |
                ------ MessagesNotifie r_Client.cpp
                ------ MessagesNotifie r_Client.h
                >
                >
                >
                Any ideas where is the problem, or how I should configure VisualStudio?
                >
                >
                Thanks for your support.
                Assuming Lnk2019 is a linker error for missing functions, I suggest try
                adding your project A (where your functions is declared) as a reference
                to project B( where you are using the function).

                Comment

                Working...