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. Linker Error

Linker Error

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelptutorialquestion
3 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.
  • D Offline
    D Offline
    Don Guy
    wrote on last edited by
    #1

    Hello there

    I made a sample C++ Win32 console application and then added a class CFileParser.

    Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.

    Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.

    Fro some reason it's not able to detect the function inside the clas CFileParser.

    Any idea how to resolve this?

    Thanks in advance

    <pre lang="vb">error LNK2019: unresolved external symbol &quot;public: void __thiscall CFileParser::OpeningInstructions(void)&quot; (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
    1&gt;C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre>

    L C 2 Replies Last reply
    0
    • D Don Guy

      Hello there

      I made a sample C++ Win32 console application and then added a class CFileParser.

      Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.

      Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.

      Fro some reason it's not able to detect the function inside the clas CFileParser.

      Any idea how to resolve this?

      Thanks in advance

      <pre lang="vb">error LNK2019: unresolved external symbol &quot;public: void __thiscall CFileParser::OpeningInstructions(void)&quot; (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
      1&gt;C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre>

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

      Let's see the code for the CFileParser definitions, and also the place where you call it in your main program. Are you sure you added the full implementation into your project? Or, if the CFileParser class is created as an external library, did you include that in your linker preferences?

      One of these days I'm going to think of a really clever signature.

      1 Reply Last reply
      0
      • D Don Guy

        Hello there

        I made a sample C++ Win32 console application and then added a class CFileParser.

        Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.

        Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.

        Fro some reason it's not able to detect the function inside the clas CFileParser.

        Any idea how to resolve this?

        Thanks in advance

        <pre lang="vb">error LNK2019: unresolved external symbol &quot;public: void __thiscall CFileParser::OpeningInstructions(void)&quot; (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
        1&gt;C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre>

        C Offline
        C Offline
        chaau
        wrote on last edited by
        #3

        You need to add a cpp file or a lib file to your project depending on what you've got. If you have FileParser.cpp file (most likely this is the case) do the following: In the Solution Explorer right click on the project and Select Add->Existing Item. Locate your FileParser.cpp and select it. If you are given a lib file together with the FileParser.h you need to add it via the Project properties. In the Solution Explorer right click on your project and select Properties. Go to Linker options -> Input. In the Additional dependencies field type the name of your lib file, e.g. FileParser.lib.

        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