3

I use ITK-4.11 and OpenCV-3.2 together in one of my c++ project, when I compile the project, I get an error that says:

Error 1 error LNK2005: png_get_uint_31 already defined in itkpng-4.11.lib(pngrutil.obj)"

Both of my ITK and OpenCV are built using Multi-threaded DLL (/MD), then, what should I do to avoid this error?

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Wei Ye
  • 131
  • 4

1 Answers1

1

If I remember correctly, I solved that exact problem by using /FORCE linker option. More info here.

Community
  • 1
  • 1
Dženan
  • 3,329
  • 3
  • 31
  • 44
  • Thank you Dženan, using /FORCE in visual studio perfectly solved the problem. – Wei Ye Apr 13 '17 at 03:02
  • Also, someone else ran into this issue recently and proposed a patch to fix it on ITK's part: http://review.source.kitware.com/#/c/22282/ – Dženan Apr 13 '17 at 14:07
  • Yes Dženan. Adding a line "#define png_get_uint_31 itk_png_get_uint_31" in the ITK file "Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h" is definitely a better solution! Thank you again. – Wei Ye Apr 17 '17 at 04:13
  • Besides accepting my answer, you can also up-vote it. – Dženan Apr 17 '17 at 16:12