The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 6 of 6

Thread: Studio : Visual C++ Adding (.lib) refrence!?

  1. #1

    Afrostyle Studio : Visual C++ Adding (.lib) refrence!?

    Using visual studio:

    I created a static library in visual c++ which produces mystaticlib.lib

    I want to use this lib in another program also written in visual C++.

    When using the Browse add new refrence dialogue in visual stuido you may only select from the following file types:

    .dll, tlb, ocx, olb, exe

    wtf?

    One way to accomplish this is by creating the second project as part of the same solution and using the projects dialogue. But this is undesireable!

  2. #2
    .lib is a library. A library is used for linking when you compile your project. As you said, it is a static library and compiled into your program. A .dll is a dynamic load library, which is loaded at runtime.

    If you want to link with this static library, go to the project properties, under linking, add the link to this file.
    If you notice this notice you will notice that this notice is not worth noticing.

    "Are you doing anything tonight? If not, how about me?"

    Opera Sucks! - FIX IT
    Oliver Zheng

  3. #3
    Just go to project properties -> Configuration properties -> Linker.
    Goto to ->General and set the "Additional Library directories" to point to your lib file directory.

    Then goto to Linker -> Input and type in your lib file name e.g. mystaticlib.lib in the "Additional Dependencies" field

  4. #4
    1,627
    posts
    hugeExplosions = true;
    glut.lib glut32.lib

    gogogogo OGL!
    MS Paint FTW!


  5. #5
    to link a lib dont bother with messing with the project file and use:
    Code:
    #pragma comment( lib, "mystaticlib" )
    so in case you want to use the same file in another project you can just include it without having to change the project file also.

  6. #6
    Quote Originally Posted by yaim0310 View Post
    to link a lib dont bother with messing with the project file and use:
    Code:
    #pragma comment( lib, "mystaticlib" )
    so in case you want to use the same file in another project you can just include it without having to change the project file also.
    That isn't portable. Works for VC++, but won't work on every compiler.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012