Search code examples
c++macoslinker-errorsrgbaopenexr

OpenEXR linker error when 'half' type is assigned


I'm having an issue assigning values to an Imf::Rgba struct containing half types as defined by OpenEXR. There appears to be a linker error that concerns the conversion from float to half.

Linking CXX executable graphics-env
Undefined symbols for architecture x86_64:
  "half::_eLut", referenced from:
      half::half(float) in main.cpp.o
  "half::convert(int)", referenced from:
      half::half(float) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [graphics-env] Error 1
make[1]: *** [CMakeFiles/graphics-env.dir/all] Error 2
make: *** [all] Error 2

I believe this is a common problem on windows and that OPENEXR_DLL needs to be defined. This does not work however as I am compiling on OS X. I have tried linking to libIlmImf.dylib and libIlmImf.a with the same result. The version of OpenEXR being used is 2.2.0 and installed using Homebrew.


Solution

  • These symbols are defined in half.h that is part of IlmBase.

    You should link to libHalf.dylib.