×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    14

    Question Visual C++: LIB not found linker error

    Howdy,

    I am new to Visual Studio .NET 2003 and 2nd Edition FP2 SDK. When I used the "Import Symbian project" function for my Symbian projects and added them to my solution, it seems that the Visual C++'s Build function does not link correctly. I have several projects that build a dll, and I have set the compilation order correctly (via dependencies).

    When I try to build the solution, the linker does not find the .lib files that are related to the projects that were just built. It tries to find the libs from weird places, such as the project's home dir, ./ and such places. Where can I set that directory in Visual C++?

    In command prompt everything works fine. Also if I use abld makefile vc7 instead on the "Import Symbian project" function, compilation & linking works. But then I cannot get the code completion (Intellisense) to work correctly.

    -Jussi

  2. #2
    Super Contributor
    Join Date
    Sep 2004
    Posts
    1,048
    Hi,

    You don't explicitely indicate if you are using NDS, but from your question I assume that this is the case so I will provide an answer from the NDS perspective.

    NDS does not automatically set up those kinds of dependencies for emulator builds (target builds and running abld are based on information in the bld.inf file and the mmp file and if you have set up those, then they will work properly).

    To add a library reference to your project, you need to do the following 2 steps for each Deb_xxx_WINS(CW) configuration:

    Select: Project -> Properties -> C/C++ -> General -> Additional Include Directories.
    Add the path to the library header file here.

    Select: Project -> Properties -> Linker -> Input -> Additional Depencies
    Add here the name of the library: <mylib>.lib

    Note that this info will then be propagated to the .mmp file if you have mpp update enabled. You need to add this info into the Deb_xx _WINS(CW) configuration for each SDK that you have enabled for your project.

    Also, if you have a project that uses a DLL, you must manually construct the required final package (.pkg) file, the automatic package file generation function does not automatically add things like DLLs into a pkg file. For information on how to set up the required package file, refer to the SDK documentation.

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    14
    Originally posted by mitts
    Hi,

    You don't explicitely indicate if you are using NDS, but from your question I assume that this is the case so I will provide an answer from the NDS perspective.
    Yes, that is the correct assumption.


    NDS does not automatically set up those kinds of dependencies for emulator builds (target builds and running abld are based on information in the bld.inf file and the mmp file and if you have set up those, then they will work properly).
    Yes, I have set up the mmp file correctly so that was not the problem.


    Note that this info will then be propagated to the .mmp file if you have mpp update enabled.
    Since I have already set up the mmp file correctly this would not have an effect, right?


    Also, if you have a project that uses a DLL, you must manually construct the required final package (.pkg) file, the automatic package file generation function does not automatically add things like DLLs into a pkg file.
    I have also done that.

    The problem was that I went ahead and set up the project dependencies (right-click Solution in solution explorer) in Visual C++ to make the project build order correct since some of the projects need lib files that are produced by the other projects. (I have one solution that includes all of these interrelated projects - I've used the Import Symbian project function for all of them and then added the projects manually to one single solution.) However, setting up the project dependencies in Visual C++ seemed to produce these problems while linking.

    When I set up the project dependencies correctly (to be able to rebuild the whole solution even from scratch with one click) and select Build->Build solution, the project that is not dependent on any other projects compiles and links fine, but the second project that depends on the lib of the first project produces this error:

    Generating Code...
    Linking...
    LINK : fatal error LNK1181: cannot open input file '\Symbian\8.0a\S60_2nd_FP2\myProgs\testProg\test.lib'

    So it tries to find the lib from the wrong place (for some projects the project's home folder, for some ./, for some the lib without any prefix) instead of epoc32\release\wins\udeb. However, when I remove all project dependencies from the solution everything works just fine! But if I rebuild (which removes the lib files) then the link fails and of course every time I start building from scratch I need to e.g. build the projects manually in a sequence that satisfies the project dependencies.

  4. #4
    Super Contributor
    Join Date
    Sep 2004
    Posts
    1,048
    OK, now I see, sorry for the rant :-).

    It seems that the VS dependency mechanism has some built-in assumptions on where to find other components such as libraries that over-ride the additional project property settings that NDS depends on. It was not an NDS design goal to support multiproject interaction so we never looked in detail at dependencies and they are in that sense not supported.

    From your description of the problem, it seems that you must remove the depencies and revert to manual building in the right order.

    Small side note: If you have set up the Project properties, the mmp update will copy them to the .mmp file: saves you a little bit of work. If you do modify the mmp file yourself, then the mmp updater will find that everything is in order and not update.

    Thanks for highlighting this issue.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×