progmDong
progmDong

Reputation: 29

Get Error when writing dynamic libr which would use static lib

I'm writing a maya plugin which would be compiled to a .dll, but in the code I use boost's static lib. When I compile my code in debug mode I got an error like this:

libboost_regex-vc100-mt-gd-1_55.lib(instances.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in pluginMain.obj

Can anyone help me to figure out the reason and provide a solution?

Upvotes: 1

Views: 44

Answers (1)

Peter R
Peter R

Reputation: 2985

This means that you have compiled the regex library using different iterator debug/security settings to your main project. There are 2 different iterator settings that are affected:

  1. Checked iterators - these ensure that the bounds of your containers are not overwritten
  2. Iterator debugging - this detects incorrect iterator use and asserts on violation

The Iterator debug level has three possible values:

  • Level 0 means: Disable checked iterators and disable iterator debugging
  • Level 1 means: Enable checked iterators and disable iterator debugging
  • Level 2 means: Enable iterator debugging

Level 2 is the default.

The quickest way out would be to remove the following entry from your preprocessor definitions

_ITERATOR_DEBUG_LEVEL = 0

in your dll project.

Have a look at this article for more details: http://msdn.microsoft.com/en-us/library/hh697468.aspx

Upvotes: 1

Related Questions