JohnOne Posted March 27, 2014 Posted March 27, 2014 VS 2010 I made a static library, compiled it in release mode, added it to the folder of a project I want to use it in along with the header file. It all works well in project release mode, but fails in debug mode, unless I replace release.lib with the debug.lib. How do you deal with this, I don't get it, what if I don't have access to debug.lib? First time I've tried to use a static library so please excuse my noobiness. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
cageman Posted March 27, 2014 Posted March 27, 2014 If you build debug its always advisable to also link against debug lib's / dll's. Errors can occur if you don't (also runtime errors)
Richard Robertson Posted March 28, 2014 Posted March 28, 2014 When you say fail, what is the exact error message?
JohnOne Posted March 29, 2014 Author Posted March 29, 2014 I don't know what I was doing wrong, but it appears to work now after rescanning solution.The error was along the lines of "cannot open file release.lib".Thanks men. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted March 29, 2014 Author Posted March 29, 2014 (edited) Well I'm having different issues now and these errors from vs 2010 are mind boggling.I have my static library built in release mode in project folder and all seems to work fine in both debug and release mode.But when I #include <iostream> I get compile time errors and warnings In debug mode.error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in UseStaticLib.objwarning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library Edited March 29, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Richard Robertson Posted March 30, 2014 Posted March 30, 2014 I've never heard of UseStaticLib.obj but it sounds like you've got a header that doesn't actually match up with the binary.
JohnOne Posted March 30, 2014 Author Posted March 30, 2014 That's my project.My lib project is named StaticLib, and the project using it is named UseStaticLib. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted March 30, 2014 Author Posted March 30, 2014 I've also tried the warning suggestion to "use /NODEFAULTLIB" which then spawns a host of other errors. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Richard Robertson Posted April 2, 2014 Posted April 2, 2014 I assume the errors related to /NODEFAULTLIB are about missing symbols right?
Richard Robertson Posted April 2, 2014 Posted April 2, 2014 Ok, some Googling says that setting _ITERATOR_DEBUG_LEVEL to 0 in your debug build of the static library may fix this problem. If you have a precompiled header, set it there using #define. If not using a precompiled header, just define it at the top of all your source files. Repeating the define multiple times won't hurt anything.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now