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

Author Topic: Linking the SFML using Conan on Linux  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

Xwilarg

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Personal Website
    • Email
Linking the SFML using Conan on Linux
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Linking the SFML using Conan on Linux
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/