I'm getting this strange error when trying to build my project:
C:/Program Files (x86)/SFML/lib/libsfml-graphics-s.a: error adding symbols: Archive has no index; run ranlib to add one
I built SFML myself on windows using this guide: https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php and installed SFML into the the windows program files. I'm completely certain that I'm using the same compiler to build SFML and my project. I tried running ranlib over libsfml-graphics-s.a but it didn't seem to do anything.
Here's what my CMakeLists.txt looks like:
cmake_minimum_required(VERSION 3.17)
project(SFML_test)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
set(CMAKE_VERBOSE_MAKEFILE ON)
file(GLOB SOURCES ./*.cpp)
add_executable(SFML_test ${SOURCES})
# SFML
set(SFML_STATIC_LIBRARIES TRUE)
set(SFML_DIR "C:/Program Files (x86)/SFML/lib/cmake/SFML")
find_package(SFML COMPONENTS graphics window system REQUIRED)
target_link_libraries(SFML_test sfml-graphics sfml-window sfml-system)