Jump to content

C++ static library


JohnOne
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.obj

warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...