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

Author Topic: Odd errors when I am trying to link SFML  (Read 1128 times)

0 Members and 1 Guest are viewing this topic.

ishidex2

  • Newbie
  • *
  • Posts: 2
    • View Profile
Odd errors when I am trying to link SFML
« on: October 30, 2018, 02:45:45 pm »
I am linked SFML with following CMake code:
include(mgw.cmake)

cmake_minimum_required(VERSION 2.8)

project(SFMLINCLUDETEST)

set(SFML_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/SFMLMGW/include)
set(SFML_LIB_DIR ${CMAKE_SOURCE_DIR}/SFMLMGW/lib)
#message(${SFML_LIB_DIR})
set(SFML_LIBRARIES
    ${SFML_LIB_DIR}/libsfml-graphics-s-d.a
    ${SFML_LIB_DIR}/libsfml-window-s-d.a
    ${SFML_LIB_DIR}/libsfml-system-s-d.a)
set(SFML_DEPENDENCIES
    opengl32
    winmm
    gdi32
    ${SFML_LIB_DIR}/libfreetype.a
    )


include_directories(${SFML_INCLUDE_DIR})


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSFML_STATIC -static-libgcc -static-libstdc++")
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
 

mgw.cmake just tells to use MinGW compiler:
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX i686-w64-mingw32)

# cross compilers to use for C and C++
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)

# target environment on the build host system
#   set 1st to dir with the cross compiler's C/C++ headers/libs
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})

# modify default behavior of FIND_XXX() commands to
# search for headers/libs in the target environment and
# search for programs in the build host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 


And I have this kind of  errors

../SFMLMGW/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7TextureC2Ev':
D:\Programming\C++\Releases\MinGW32-PosixDwarf730r0\build-SFML\src\SFML\Graphics/D:/Programming/C++/Releases/_Sources/SFML/src/SFML/Graphics/Texture.cpp:72: undefined reference to `_Unwind_Resume'


etc.

How to fix it?

System: LMinGWmint 19 tara
mingw version: 7.3
SFML version: 2.5.1

ishidex2

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Odd errors when I am trying to link SFML
« Reply #1 on: October 30, 2018, 03:11:14 pm »
sorry, system is Linux mint tara

 

anything