Help with a link error

Hwciua4i's Avatar, Join Date: Sep 2010
Newbie Member

I'm new to this forum and am just getting used to C++.
I have this graphics assignment in which I've been given a framework and am to implement a triangle rasterizer.

The framework includes a given library called by the instructor.
However, sometimes it compiles just fine and other times I just suddenly get this error:
LINK : fatal error LNK1181: cannot open input file 'GfxLib.lib' ... after which I am unsure how to continue as it was compiling fine a while back.
I'm using Visual Studio 2010 and the .lib file is located in both the Debug and Release folders.

Any help on how to solve this error is much appreciated.
cutithongtin's Avatar
Newbie Member
hi , this error may be caused by your not referring .lib file in your project . if you are working with VS 2k10 , try these step .
In solution explorer , right click --> properties (or press ALt + Enter ) --> Config properties --> Input -->
In the right sheet , the first line : Additional Dependencies --> you click this line and choose <edit> then add the name of your library (.lib)
Certainly, this means your .lib must be registered with your VS2010 else , you must register by right click --> properties --> Config Properties --> VC++ Directories -->
in the right sheet , the 4th line , see and click "Library Directories " --> then add your link to folder that contains your .lib files .
Cheer ,
Hwciua4i's Avatar, Join Date: Sep 2010
Newbie Member
Thanks for the reply.

Yes I had already tried going there and making sure it was all there.

The thing is, the instructor gave the framework which had all of the stuff already included.
It compiles initially but suddenly if I close and open the solution file or something - it suddenly gives the link error.

After which I check the solution explorer and make sure everything's added and still no luck. I try reloading the library project, cleaning, building, etc. with no luck. Then I try getting a fresh copy and just copying my code into it - and still I get the link error.

But suddenly if I get lucky it, I get the fresh copy and it compiles fine. So I managed to finish it and submit, but still would like to know what caused the issue if anyone knows.