Cookie
Cookie

Reputation: 12692

Remove symbol from lib file on windows

A symbol happens to be defined in two third party libraries, namely, in my case, zlib somehow got its copyright string into both.

I checked this copyright string, and it is a harmless global static string with the copyright notice.

However, I can't link due to this.

Is there an easy way to remove it in one of those libraries?

This is the error:

zlib_mdd.lib(deflate.obj) : error LNK2005: _deflate_copyright already defined in libboost_zlib-vc110-mt-gd-1_50.lib(deflate.obj)

Upvotes: 2

Views: 633

Answers (1)

Jabberwocky
Jabberwocky

Reputation: 50882

A somewhat dirty but effective method is by modifying manually the symbol in one of the .lib files with a binaray editor (e.g. PsPad).

Just change _deflate_copyright into e.g. _deflate_copyrigXX. The characters must not be removed but they must be replaced.

Don't replace the characters at the start of the symbol name (e.g. replacing _deflate_copyright by _Xeflate_copyright as this will confuse the linker's internal search algorithm.

Upvotes: 1

Related Questions