FreeImage linking error OF 12.1 on Windows
Hey! I'm getting the following linking error both using the GH version and 0.12.1 version. This is using VS 2022 on Windows 11. Same issue in both Debug and Release.
Try any example, like imageSubsectionExample.
2>------ Build started: Project: imageSubsectionExample, Configuration: Debug x64 ------
2>main.cpp
2>ofApp.cpp
2>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
2> Creating library bin\imageSubsectionExample_debug.lib and object bin\imageSubsectionExample_debug.exp
2>FreeImageD.lib(IPTC.obj) : error LNK2019: unresolved external symbol __std_search_1 referenced in function "char const * __cdecl std::_Search_vectorized<char const ,char const >(char const * const,char const * const,char const * const,unsigned __int64)" (??$_Search_vectorized@$$CBD$$CBD@std@@YAPEBDQEBD00_K@Z)
2>bin\imageSubsectionExample_debug.exe : fatal error LNK1120: 1 unresolved externals
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1127,5): error MSB6006: "link.exe" exited with code 1120.
2>Done building project "imageSubsectionExample.vcxproj" -- FAILED.
FWIW If I swap in the FreeImage dir from 0.11 it works fine. That library only has a FreeImage.lib, no FreeImageD.lib.
I think this is the commit where it got changed: https://github.com/openframeworks/openFrameworks/commit/65b9effd2d00f889088a85c7a6f8399a030ad05f
Update Visual Studio
Ahh - I had the same issue and then updated visual studio and it worked again.
Ideally we wouldn’t have to do that but didn’t want to hold up 0.12.1.
Though it may be something a lot of people run into.
Yep! Just did an update and it works now. Might be worth mentioning in the forums or somewhere.
Any idea what the issue is? Seems like a weird one.
~ Elie
On Mon, May 5, 2025, 09:20 Theodore Watson @.***> wrote:
ofTheo left a comment (openframeworks/openFrameworks#8443) https://github.com/openframeworks/openFrameworks/issues/8443#issuecomment-2850988732 Ahh - I had the same issue and then updated visual studio and it worked again.
Ideally we wouldn’t have to do that but didn’t want to hold up 0.12.1.
Though it may be something a lot of people run into.— Reply to this email directly, view it on GitHub https://github.com/openframeworks/openFrameworks/issues/8443#issuecomment-2850988732, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA5HFWBOG6Y3SMUDBEITYD245QSLAVCNFSM6AAAAAB4NTHZHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNJQHE4DQNZTGI . You are receiving this because you authored the thread.Message ID: @.***>
Thanks @prisonerjohn - I posted it on the forums too. Going to tag this for the next patch release.
As just a report, in my environment, I tried vcpkg install freeimage and replaced FreeImage.lib and FreeImageD.lib. Seems working correctly without updating Visual Studio (and the same lib also working after updated Visual Studio, but not fully tested.)
I think this is not good way (version will not exact match), but I put my generated libs here. FreeImageLibs.zip
Thanks @funatsufumiya - I think the main issue is that we're building with the newest VS tools. Did you try updating VS 2022 with the latest updates?
@ofTheo
Yes. Libs generated by vcpkg in old (non-updated) environment, also working on updated Visual Studio environment.
I would have liked to also try vcpkg building with new updated msvc compiler, but I've lost old environment by updating Visual Studio for testing. So even if I do so, I cannot confirm if it's working generated new libs (from new msvc compiler) on "old" environment.
Not sure if it helps anything but I'm building this one alternatively here https://github.com/dimitre/ofLibs/releases/download/v0.12.1/oflib_FreeImage_vs.zip
Looks like maybe a mismatch in the past for Project C++ status and preview features which are now ISO compliant so changed project and template to ISO 23 should fix it. Weird STL issue though