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

**URL:** <https://forum.kirupa.com/t/studio-visual-c-adding-lib-refrence/237456>\
**Category:** Uncategorized\
**Created:** [August 30, 2007, 2:33pm UTC](https://forum.kirupa.com/t/studio-visual-c-adding-lib-refrence/237456 "2007-08-30T14:33:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashbabe](https://avatars.discourse-cdn.com/v4/letter/f/65b543/32.png) [@flashbabe](https://forum.kirupa.com/u/flashbabe)\
**Post date:** [August 30, 2007, 2:33pm UTC](https://forum.kirupa.com/t/studio-visual-c-adding-lib-refrence/237456/1 "2007-08-30T14:33:03Z")

</div>

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! ☹

---

<div class="post-metadata">

**Author:** ![atss](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@atss](https://forum.kirupa.com/u/atss)\
**Post date:** [June 3, 2008, 9:47pm UTC](https://forum.kirupa.com/t/studio-visual-c-adding-lib-refrence/237456/2 "2008-06-03T21:47:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Charleh](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@Charleh](https://forum.kirupa.com/u/Charleh)\
**Post date:** [June 4, 2008, 8:55am UTC](https://forum.kirupa.com/t/studio-visual-c-adding-lib-refrence/237456/3 "2008-06-04T08:55:14Z")

</div>

glut.lib glut32.lib

gogogogo OGL! 😃

---

<div class="post-metadata">

**Author:** ![yaim0310](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@yaim0310](https://forum.kirupa.com/u/yaim0310)\
**Post date:** [June 28, 2008, 8:14pm UTC](https://forum.kirupa.com/t/studio-visual-c-adding-lib-refrence/237456/4 "2008-06-28T20:14:45Z")

</div>

to link a lib dont bother with messing with the project file and use:

```auto
#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.
