Strange issues with linking

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

    #1

    Strange issues with linking

    This is an issue for someone much wiser than I - perhaps a MVP will help?

    I color coded the following for readability.
    Running XP Pro and VC++.Net Express 2008 and vtk visualization software
    In the Linker | Input ....... No additional dependencies are set
    An Expected Result Follows:
    ------ Build started: Project: Cone041906, Configuration: Debug Win32 ------

    Linking...

    Cone.obj : error LNK2019: unresolved external symbol "public: void
    __thiscall vtkCamera::Zoom (double)" (?Zoom@vtkCamer a@@QAEXN@Z) referenced in
    function _main

    //////// First and last of the 16 are shown here ///////////////

    Cone.obj : error LNK2019: unresolved external symbol "public: static class
    vtkCylinderSour ce * __cdecl vtkCylinderSour ce::New(void)"
    (?New@vtkCylind erSource@@SAPAV 1@XZ) referenced in function _main

    Debug/Cone041906.exe : fatal error LNK1120: 16 unresolved externals

    Build log was saved at "file://h:\vtk\Bobs Working
    Examples\Cone04 1906\Debug\Buil dLog.htm"

    Cone041906 - 17 error(s), 0 warning(s)

    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Now I set a dependency d:\vtk50\Lib thinking that this should resolve the
    missing 16 unresolved externals

    Result Follows:
    ------ Rebuild All started: Project: Cone041906, Configuration: Debug
    Win32 ------

    Deleting intermediate and output files for project 'Cone041906',
    configuration 'Debug|Win32'

    Compiling...

    Cone.cpp

    Compiling manifest to resources...

    Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0

    Copyright (C) Microsoft Corporation. All rights reserved.

    Linking...

    LINK : fatal error LNK1104: cannot open file 'd:\vtk50\Lib.o bj'

    Build log was saved at "file://h:\vtk\Bobs Working
    Examples\Cone04 1906\Debug\Buil dLog.htm"

    Cone041906 - 1 error(s), 0 warning(s)

    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    It seems that the Linker now finds the unresolved externals

    and generates the need for a Lib.obj file that doesn't exist!

    Why does the Linker find the .Lib files and then generate the need for a
    Lib.obj file that it didn't need before?


  • Tom Walker

    #2
    Re: Strange issues with linking

    "Bob Palank" <bob@stlcc.orgw rote in message
    news:b2Tij.2037 $aC6.1959@newsf e07.lga...
    This is an issue for someone much wiser than I - perhaps a MVP will help?
    >
    Now I set a dependency d:\vtk50\Lib thinking that this should resolve the
    missing 16 unresolved externals
    >
    It seems that the Linker now finds the unresolved externals
    >
    and generates the need for a Lib.obj file that doesn't exist!
    >
    Why does the Linker find the .Lib files and then generate the need for a
    Lib.obj file that it didn't need before?
    >
    You added a linker dependency on d:\vtk50\Lib. A dependency should be either
    a .lib or .obj file. Since you didn't provide a file type, the linker
    assumed you meant .obj. You probably meant to add a dependency such as
    d:\vtk50\Lib\My Lib.lib.

    The 16 unresolved externals errors did not go away, its just that the linker
    was not able to get to the point of trying to resolve externals since you
    provided a bad dependency.

    Comment

    • Bob Palank

      #3
      Re: Strange issues with linking

      Thanks for the clear response.
      So, if I have 20 .lib files in one folder, I need to reference each .lib
      file individually ?
      Is there a simpler way ?
      TIA
      Bob
      "Bob Palank" <bob@stlcc.orgw rote in message
      news:b2Tij.2037 $aC6.1959@newsf e07.lga...
      This is an issue for someone much wiser than I - perhaps a MVP will help?
      >
      I color coded the following for readability.
      Running XP Pro and VC++.Net Express 2008 and vtk visualization software
      In the Linker | Input ....... No additional dependencies are set
      An Expected Result Follows:
      ------ Build started: Project: Cone041906, Configuration: Debug
      Win32 ------
      >
      Linking...
      >
      Cone.obj : error LNK2019: unresolved external symbol "public: void
      __thiscall vtkCamera::Zoom (double)" (?Zoom@vtkCamer a@@QAEXN@Z) referenced
      in function _main
      >
      //////// First and last of the 16 are shown here ///////////////
      >
      Cone.obj : error LNK2019: unresolved external symbol "public: static class
      vtkCylinderSour ce * __cdecl vtkCylinderSour ce::New(void)"
      (?New@vtkCylind erSource@@SAPAV 1@XZ) referenced in function _main
      >
      Debug/Cone041906.exe : fatal error LNK1120: 16 unresolved externals
      >
      Build log was saved at "file://h:\vtk\Bobs Working
      Examples\Cone04 1906\Debug\Buil dLog.htm"
      >
      Cone041906 - 17 error(s), 0 warning(s)
      >
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
      ==========
      >
      Now I set a dependency d:\vtk50\Lib thinking that this should resolve the
      missing 16 unresolved externals
      >
      Result Follows:
      ------ Rebuild All started: Project: Cone041906, Configuration: Debug
      Win32 ------
      >
      Deleting intermediate and output files for project 'Cone041906',
      configuration 'Debug|Win32'
      >
      Compiling...
      >
      Cone.cpp
      >
      Compiling manifest to resources...
      >
      Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
      >
      Copyright (C) Microsoft Corporation. All rights reserved.
      >
      Linking...
      >
      LINK : fatal error LNK1104: cannot open file 'd:\vtk50\Lib.o bj'
      >
      Build log was saved at "file://h:\vtk\Bobs Working
      Examples\Cone04 1906\Debug\Buil dLog.htm"
      >
      Cone041906 - 1 error(s), 0 warning(s)
      >
      ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
      >
      It seems that the Linker now finds the unresolved externals
      >
      and generates the need for a Lib.obj file that doesn't exist!
      >
      Why does the Linker find the .Lib files and then generate the need for a
      Lib.obj file that it didn't need before?
      >
      >

      Comment

      • Tom Walker

        #4
        Re: Strange issues with linking

        "Bob Palank" <bob@stlcc.orgw rote in message
        news:FF3jj.27$i 03.3@newsfe07.l ga...
        Thanks for the clear response.
        So, if I have 20 .lib files in one folder, I need to reference each .lib
        file individually ?
        Yes.
        Is there a simpler way ?
        Not really.

        You can add the folder to the linker's "Additional Libraries Directory"
        setting, then you wouldn't have to specify the full path for each library.
        But you still must explicitly specify each library.

        Another way to specify the libraries is to put statements like these into
        one of your source files:
        #pragma comment(lib, "MyLib1.lib ")
        #pragma comment(lib, "MyLib2.lib ")

        Comment

        Working...