Yup, moving everything back to the main.cpp file fixed the problem, and also fixed another problem I was having where I couldn't interact with the ImGui widgets if I clicked off the SFML window.
So yeah, moving those 5 lines to a separate file to have less code in the main.cpp files defiantly wasn't worth it.
As for the ImGui-SFML issue tracker, well, there are barely any posts on there, and all of the posts made during 2021 either have one or no replies so it seemed pretty dead to me.