I'm getting the following linker errors...
/bin/ld: /home/david/C/vcpkg/installed/x64-linux/lib/libFreeImage.a(PluginEXR.cpp.o): in function `InitEXR(Plugin*, int)': PluginEXR.cpp:(.text+0x2ab): undefined reference to `Imf_2_5::staticInitialize()' /bin/ld: /home/david/C/vcpkg/installed/x64-linux/lib/libFreeImage.a(PluginEXR.cpp.o): in function `Save(FreeImageIO*, FIBITMAP*, void*, int, int, void*)': PluginEXR.cpp:(.text+0x45b): undefined reference to `iex_debugTrap()' /bin/ld: PluginEXR.cpp:(.text+0x639): undefined reference to `Imf_2_5::OStream::OStream(char const*)' /bin/ld: PluginEXR.cpp:(.text+0x719): undefined reference to `Imf_2_5::Header::Header(Imath_2_5::Box<Imath_2_5::Vec2<int> > const&, Imath_2_5::Box<Imath_2_5::Vec2<int> > const&, float, Imath_2_5::Vec2<float> const&, float, Imf_2_5::LineOrder, Imf_2_5::Compression)' /bin/ld: PluginEXR.cpp:(.text+0x7db): undefined reference to `iex_debugTrap()' /bin/ld: PluginEXR.cpp:(.text+0x9ac): undefined reference to `iex_debugTrap()' /bin/ld: PluginEXR.cpp:(.text+0xbe1): undefined reference to `Imf_2_5::PreviewImage::PreviewImage(unsigned int, unsigned int, Imf_2_5::PreviewRgba const*)' /bin/ld: PluginEXR.cpp:(.text+0xd4e): undefined reference to `Imf_2_5::Header::channels()' /bin/ld: PluginEXR.cpp:(.text+0xd70): undefined reference to `Imf_2_5::Channel::Channel(Imf_2_5::PixelType, int, int, bool)' /bin/ld: PluginEXR.cpp:(.text+0xd86): undefined reference to `Imf_2_5::ChannelList::insert(char const*, Imf_2_5::Channel const&)'
(shortened for brevity, full log here)
when using g++ to link, I am passing -lIlmImf-2_5, I've checked this file with `nm' and it seems to have the symbols that the linker is looking for.
$ nm --demangle libIlmImf-2_5.a | grep staticInit
0000000000000ec0 T Imf_2_5::staticInitialize()
0000000000000033 t Imf_2_5::staticInitialize() [clone .cold]
0000000000000000 b Imf_2_5::staticInitialize()::initialized
0000000000000020 b Imf_2_5::staticInitialize()::criticalSection
$ nm --demangle libIlmImf-2_5.a | grep iex
U iex_debugTrap()
U iex_debugTrap()
U iex_debugTrap()
U iex_debugTrap()
U iex_debugTrap()
...
Does anyone know how to fix this?
Edit: I now understand that the order of the libs matters, thanks n-1-8e9. However I still have some problems I can't sort out.
/bin/ld: /home/david/C/vcpkg/installed/x64-linux/lib/libshaderc_util.a(compiler.cc.o): in function `shaderc_util::GlslangInitializer::GlslangInitializer()':
compiler.cc:(.text+0x59): undefined reference to `glslang::InitializeProcess()'
This error message tells me that I need -lglslang
after -lshaderc_util
but I already have it that way...
-lshaderc -lshaderc_util -lglslang -lglslang-default-resource-limits
How do I fix it?