Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Popinaodude

Pages: [1]
1
General / Re: error adding symbols: Archive has no index
« on: January 08, 2021, 09:29:34 pm »
As it turns out, I WASN'T building SFML and running the project with the same compiler. I have two versions of mingw-64 installed on my computer and even though I had specified which to use, CMake still used the other one. I only discovered this after deleting the other version and trying to run again, it told me the compiler was missing. Once I rebuilt everything with the right compiler everything worked.

2
General / error adding symbols: Archive has no index
« on: January 08, 2021, 09:12:55 pm »
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)


3
Hi there,

I'm just trying to get my SFML setup working properly so I can get started on a project and I've spent the past day trawling through forum posts old and recent but none of the fixes suggested before have worked for me.

I have built SFML myself using static libraries with the CMake GUI. I am using the CLion IDE.

Here is the contents of my CMakeLists.txt file:
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 2.5 COMPONENTS system graphics window audio REQUIRED)
target_link_libraries(SFML_test sfml-system sfml-graphics sfml-window sfml-audio)
 

Here is the full build log with the error when I try and build:
====================[ Build | SFML_test | Debug ]===============================
"C:\Program Files\JetBrains\CLion 2020.3\bin\cmake\win\bin\cmake.exe" --build D:\Weekend_Projects\SFML_test\cmake-build-debug --target SFML_test -- -j 9
-- Found SFML 2.5.1 in C:/Program Files (x86)/SFML/lib/cmake/SFML
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Weekend_Projects/SFML_test/cmake-build-debug
[ 50%] Building CXX object CMakeFiles/SFML_test.dir/main.cpp.obj
[100%] Linking CXX executable SFML_test.exe
"C:\Program Files\JetBrains\CLion 2020.3\bin\cmake\win\bin\cmake.exe" -E rm -f CMakeFiles\SFML_test.dir/objects.a
C:\PROGRA~1\MINGW-~1\I686-7~1.0-R\mingw32\bin\ar.exe cr CMakeFiles\SFML_test.dir/objects.a @CMakeFiles\SFML_test.dir\objects1.rsp
C:\PROGRA~1\MINGW-~1\I686-7~1.0-R\mingw32\bin\G__~1.EXE  -static -g   -Wl,--whole-archive CMakeFiles\SFML_test.dir/objects.a -Wl,--no-whole-archive  -o SFML_test.exe -Wl,--out-implib,libSFML_test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\SFML_test.dir\linklibs.rsp
CMakeFiles\SFML_test.dir/objects.a(main.cpp.obj): In function `main':
D:/Weekend_Projects/SFML_test/main.cpp:6: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
D:/Weekend_Projects/SFML_test/main.cpp:8: undefined reference to `sf::String::String(char const*, std::locale const&)'
D:/Weekend_Projects/SFML_test/main.cpp:8: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
D:/Weekend_Projects/SFML_test/main.cpp:8: undefined reference to `sf::RenderWindow::~RenderWindow()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\SFML_test.dir\build.make:120: SFML_test.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:98: CMakeFiles/SFML_test.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:105: CMakeFiles/SFML_test.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:137: SFML_test] Error 2
 

I've tried switching around the linked libraries with no luck. I'm sure there's something very simple that I'm missing. Any help would be appreciated, thanks!

Pages: [1]