Jump to content
  • Advertisement
Sign in to follow this  

Linking to a static library?

This topic is 2928 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I have a weird problem with VS2010, I was hoping someone could help with.

I have a solution with two projects, a static library and a command-line application. I've added a 'reference' to the static-library, to say it should be linked with the application. Apparently this changed in VS2010 - I used to do it through the Project Dependencies, which no longer functions.

If I build the library by itself, everything is fine. I can see the library file is output successfully.

However for some strange reason, if I build the application it first deletes the library and then complains that it doesn't exist when it tries to link...

I'm not sure if the library is rebuilt first before it's deleted - the output suggests it is, but if so it is deleted again too quickly for me to see.

Does anyone have any idea what is going on?

Many thanks!

Share this post

Link to post
Share on other sites
Here's the output, in case anyone can spot something..

------ Rebuild All started: Project: CryptoLib, Configuration: Debug Win32 ------
Build started 06/10/2011 19:13:06.
Deleting file "..\..\Obj\Debug\CryptoLib.lastbuildstate".
Creating "..\..\Obj\Debug\CryptoLib.unsuccessfulbuild" because "AlwaysCreate" was specified.
CryptoLib.vcxproj -> C:\Users\Administrator\Desktop\T1\VS2010\CryptoLib\..\..\Bin\CryptoLib\Debug\CryptoLib_d.lib
Deleting file "..\..\Obj\Debug\CryptoLib.unsuccessfulbuild".
Touching "..\..\Obj\Debug\CryptoLib.lastbuildstate".

Build succeeded.

Time Elapsed 00:00:00.81
------ Rebuild All started: Project: Gateway, Configuration: Debug Win32 ------
Build started 06/10/2011 19:13:07.
Deleting file "..\..\Obj\Debug\Gateway.lastbuildstate".
Touching "..\..\Obj\Debug\Gateway.unsuccessfulbuild".
Generating Code...
LINK : fatal error LNK1104: cannot open file 'C:\Users\Administrator\Desktop\T1\Bin\CryptoLib\Debug\CryptoLib_d.lib'


Time Elapsed 00:00:10.54
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

In any case, the library is built but by the time it needs to be linked with, it's been deleted :/

Share this post

Link to post
Share on other sites
I have totally had this issue before an it drove me nuts.

Try re-installing MSVS and recreating your projects/solutions.
If that doesn't work give up and become an escort. (or make another post)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!