0

As soon as I built the FreeImaged.lib and #included FreeImage.h linked it to my WORKING wxWidgets + OpenCV dependent project, I got errors mainly in two files: init.h and atomic.h.

Most of the errors state that:

  • HINSTANCE is undefined
  • wxEntry already defined as function
  • wxEntryStart already defined as function
  • InterlockedDecrement is undefined

If I comment out the #include <FreeImage.h> then all the errors are gone. Why does this happen? How can I fix this?

hello all
  • 252
  • 2
  • 17
  • HINSTANCE and InterlockedDecrement are Windows API functions and types. They are not related to FreeImage. http://msdn.microsoft.com/en-us/library/windows/desktop/ms683580%28v=vs.85%29.aspx – PaulMcKenzie Sep 13 '14 at 03:56
  • @PaulMcKenzie ah... I changed `#include "afxres.h"` to `#include ` (I'm using VS2013) in OpenEXR, one of the FreeImage dependencies. that might be related to this issue somehow. – hello all Sep 13 '14 at 04:28

1 Answers1

0

Your errors are probably due to #include <windows.h> somewhere in FreeImage. Include wxWidgets headers first, they take care to neutralize most of the harmful definitions in <windows.h>. If you have to include the other one first, include <wx/msw/winundef.h> immediately after it to undefine them.

If this doesn't help, you really should update your question with the precise errors you're getting (at least the first one or two).

VZ.
  • 21,740
  • 3
  • 39
  • 42