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. unresolved external symbol

unresolved external symbol

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studioquestion
9 Posts 4 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.
  • A Offline
    A Offline
    AndreFratelli
    wrote on last edited by
    #1

    I there This is a bit strange... I had a project (VS 2005 Pro) with all the code written in the header (.h) files. This is an OO project, so I had the class definitions and method implementations on the same file. Then, I separated the files, definition in headers, implementation in code files. But now I get 7 unresolved external symbols and the project won't compile. The strange thing is that before the separation all was normal. What do you guys think it can be? Best regards

    Fratelli

    L S 2 Replies Last reply
    0
    • A AndreFratelli

      I there This is a bit strange... I had a project (VS 2005 Pro) with all the code written in the header (.h) files. This is an OO project, so I had the class definitions and method implementations on the same file. Then, I separated the files, definition in headers, implementation in code files. But now I get 7 unresolved external symbols and the project won't compile. The strange thing is that before the separation all was normal. What do you guys think it can be? Best regards

      Fratelli

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      AndreFratelli wrote:

      What do you guys think it can be?

      Nothing special, just plain old coding errors. Not sure what you are asking, I mean you did not post any error messages with the related code so I don't know what you think we can do it about it short of re-writing all the C++ documentation that already exists which wouldn't make any sense since you have already proven you don't read it.

      led mike

      A 1 Reply Last reply
      0
      • A AndreFratelli

        I there This is a bit strange... I had a project (VS 2005 Pro) with all the code written in the header (.h) files. This is an OO project, so I had the class definitions and method implementations on the same file. Then, I separated the files, definition in headers, implementation in code files. But now I get 7 unresolved external symbols and the project won't compile. The strange thing is that before the separation all was normal. What do you guys think it can be? Best regards

        Fratelli

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        AndreFratelli wrote:

        I there

        I'm sure you are. As for your coding problems it would be helpful if you included the error messages.

        Steve

        A 1 Reply Last reply
        0
        • L led mike

          AndreFratelli wrote:

          What do you guys think it can be?

          Nothing special, just plain old coding errors. Not sure what you are asking, I mean you did not post any error messages with the related code so I don't know what you think we can do it about it short of re-writing all the C++ documentation that already exists which wouldn't make any sense since you have already proven you don't read it.

          led mike

          A Offline
          A Offline
          AndreFratelli
          wrote on last edited by
          #4

          led mike wrote:

          I don't know what you think we can do it about it short of re-writing all the C++ documentation that already exists which wouldn't make any sense since you have already proven you don't read it.

          You don't even have a reason to think that. I get unresolved external symbols only after separating the code into files... Wouldn't it be reasonable it would work just as well? Before, I had this: // file whatever.h

          #ifndef __WHATEVER_H
          #define __WHATEVER_H
          class Whatever
          {
          void method();
          };

          void Whatever::method()
          {
          }
          #endif

          Now I have this: // file whatever.h

          #ifndef __WHATEVER_H
          #define __WHATEVER_H
          class Whatever
          {
          void method();
          };
          #endif

          // file whatever.cpp

          #include "whatever.h"

          void Whatever::method()
          {
          }

          And I get these: caminho.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Capacidade::reserva(class Fluxo)" (?reserva@Capacidade@@QAE_NVFluxo@@@Z) referenced in function "public: bool __thiscall Caminho::ligar(void)" (?ligar@Caminho@@QAE_NXZ) caminho.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Capacidade::liberta(class Fluxo)" (?liberta@Capacidade@@QAE_NVFluxo@@@Z) referenced in function "public: void __thiscall Caminho::desligar(void)" (?desligar@Caminho@@QAEXXZ) caminho.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall Capacidade::suporta(class Fluxo)const " (?suporta@Capacidade@@QBEIVFluxo@@@Z) referenced in function "public: bool __thiscall Caminho::ping(void)const " (?ping@Caminho@@QBE_NXZ) grafo.obj : error LNK2019: unresolved external symbol "public: unsigned int const __thiscall No::id(void)const " (?id@No@@QBE?BIXZ) referenced in function "public: bool __thiscall Grafo::ligados(unsigned int,unsigned int)const " (?ligados@Grafo@@QBE_NII@Z) grafo.obj : error LNK2019: unresolved external symbol "public: class No * __thiscall Ligacao::destino(void)const " (?destino@Ligacao@@QBEPAVNo@@XZ) referenced in function "public: bool __thiscall Grafo::ligados(unsigned int,unsigned int)const " (?ligados@Grafo@@QBE_NII@Z) grafo.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall Capacidade::custo(class Fluxo)const " (?custo@Capacidade@@QBEIVFluxo@@@Z) referenced in function "public: class Caminho __thiscall Grafo::dijkstra(unsigned int,unsigned int,class Fluxo)const " (?dijkstra@Grafo@@QBE?AVCaminho@@IIVFluxo@@@Z) grafo.obj : error LNK2019: unresolved e

          1 Reply Last reply
          0
          • S Stephen Hewitt

            AndreFratelli wrote:

            I there

            I'm sure you are. As for your coding problems it would be helpful if you included the error messages.

            Steve

            A Offline
            A Offline
            AndreFratelli
            wrote on last edited by
            #5

            Stephen Hewitt wrote:

            As for your coding problems it would be helpful if you included the error messages.

            Done that =) I already figured out what it is. I started searching what did the unresolved names add in common and notice they were all marked as inline! Removed the "inline" keyword every in the project.. and it works! Can anybody explain this? How can I solve it? regards

            Fratelli

            S A 2 Replies Last reply
            0
            • A AndreFratelli

              Stephen Hewitt wrote:

              As for your coding problems it would be helpful if you included the error messages.

              Done that =) I already figured out what it is. I started searching what did the unresolved names add in common and notice they were all marked as inline! Removed the "inline" keyword every in the project.. and it works! Can anybody explain this? How can I solve it? regards

              Fratelli

              S Offline
              S Offline
              Stephen Hewitt
              wrote on last edited by
              #6

              That will work. Can you post your actual code: the names in the error messages don't match up to code you posted.

              Steve

              A 1 Reply Last reply
              0
              • A AndreFratelli

                Stephen Hewitt wrote:

                As for your coding problems it would be helpful if you included the error messages.

                Done that =) I already figured out what it is. I started searching what did the unresolved names add in common and notice they were all marked as inline! Removed the "inline" keyword every in the project.. and it works! Can anybody explain this? How can I solve it? regards

                Fratelli

                A Offline
                A Offline
                Alan Balkany
                wrote on last edited by
                #7

                I think the code for inline functions must appear in your header file; you can't have just the declaration. It's similar to a macro.

                A 1 Reply Last reply
                0
                • S Stephen Hewitt

                  That will work. Can you post your actual code: the names in the error messages don't match up to code you posted.

                  Steve

                  A Offline
                  A Offline
                  AndreFratelli
                  wrote on last edited by
                  #8

                  The code is kind of large for me to post it here =/ The errors refer many files and functions... Is there a way for me to post the entire source here? regards

                  Fratelli

                  1 Reply Last reply
                  0
                  • A Alan Balkany

                    I think the code for inline functions must appear in your header file; you can't have just the declaration. It's similar to a macro.

                    A Offline
                    A Offline
                    AndreFratelli
                    wrote on last edited by
                    #9

                    I know that for templates, but with plain inline functions too? =/ Never happened to me before... Is this a VS thing? regards

                    Fratelli

                    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