Print Page | Close Window

LNK2005 errors

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=14675
Printed Date: 22 June 2025 at 3:08am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: LNK2005 errors
Posted By: Ark42
Subject: LNK2005 errors
Date Posted: 02 July 2009 at 12:18pm
I'm getting a ton of errors like:
FreeImage.lib(png.obj) : error LNK2005: _png_set_sig_bytes already defined in ToolkitPro1122vc71S.lib(png.obj)
Because both libraries I'm trying to link with statically include their own internal libpng. Is there a way to work-around this, or have Codejock hide the png symbols internally so they don't conflict?




Replies:
Posted By: znakeeye
Date Posted: 02 July 2009 at 12:51pm
You're obviously using FreeImage, which links to png.lib - so does XTP. There are a couple of solutions:
 
1) Remove png-sources from XTP and recompile.
2) Remove png-sources from both XTP and FreeImage, and recompile png.dll for dynamic linking.
 
I believe you can tell the compiler which lib to use, but I don't remember the switch.


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 02 July 2009 at 12:52pm
Btw, how good is FreeImage compared to other libraries, such as http://www.xdp.it/cximage.htm - CxImage  and MFC CImage?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: Ark42
Date Posted: 02 July 2009 at 1:03pm
Remove from FreeImage = program crash. I removed the png/zlib stuff from XTP and my app appears to work now. FreeImage has the newer of the libpngs anyway. I wasn't sure if I'd break some Skin or other stuff in XTP by making it link to FreeImage's copy of libpng though.

FreeImage compiles under Linux and OS X as well as Windows, and has a very simply C (not C++) interface. I like the easy syntax of just calling a single function to load a file, and getting easy access to raw 32bit RGBA buffers. I've never used CxImage, but I looked into ImageMagick and IM was very complex and full of stuff I didn't need. FI can also load from memory very easily. I don't know if CxImage was around when I started using and contributing to FreeImage, but at quick glance, it looks more similar to ImageMagick to me - full of complex cruft that I don't need.

CImage requires GDIPlus, which pretty much throws it out the window as far as portability goes, and I think that means you can't even assume your app would work under Win2000 either. Most of my apps have a "core" that compiles and runs under OS X, with only a thin layer of GUI wrapper on top that has to differ between OS X and Windows builds.



Posted By: Oleg
Date Posted: 06 July 2009 at 1:21am
Hi,
 
Think most easy way was replace all png files from FreeImage to Toolkit to be sure they all same.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net