SFML community forums

Help => General => Topic started by: Xwilarg on November 24, 2019, 05:28:30 am

Title: Linking the SFML using Conan on Linux
Post by: Xwilarg on November 24, 2019, 05:28:30 am
Hi,

I'm trying to use the SFML with Conan so I have a conanfile that looks like that:
[requires]
sfml/2.5.1@bincrafters/stable

[options]
sfml:graphics=True

[generators]
cmake
And the following cmake:
cmake_minimum_required(VERSION 3.1)
project(RythmHero)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

if(MSVC)
    SET(CMAKE_CXX_FLAGS "/W4 /EHsc /std:c++17")
else()
    SET(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++17 -L.")
endif()
file(GLOB_RECURSE SRCS "src/*.cpp")
include_directories(inc build/irrKlang/include)
add_executable(${PROJECT_NAME} ${SRCS})
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} IrrKlang)
 
I'm launching it this way:
#!/bin/sh
mkdir -p build                  
cd build
conan remote add SFML https://api.bintray.com/conan/bincrafters/public-conan
set -e
conan install .. --build=missing
cmake ..
cmake --build . --config RELEASE
 
On Windows it's working fine but on Linux I have the following error:
undefined reference to `sf::String::String(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::locale const&)'
 
I saw on the tutorial that I may have to link the SFML with -lsfml-graphics -lsfml-window -lsfml-system but since it's installed with Conan I don't know the path to use -L

Would someone please know how I can link the SFML on Linux with conan?
Title: Re: Linking the SFML using Conan on Linux
Post by: eXpl0it3r on November 24, 2019, 01:31:31 pm
I think this is more related to the ABI change for strings. You'd need to make sure that SFML is also built with the C++17 flag.