Hi folks. Since y'all suggested I upgrade SFML, I am trying to do that.
Here's my problem, and I've already found a few posts about it but they aren't solving my issues.
I downloaded SFML 2.4.2, GCC 6.1.0 MinGW (DW2) - 32-bit (I'm using codeblocks)
In my cmake files (I have two projects, one is a library I created and one is my game), I changed:
find_package(SFML REQUIRED COMPONENTS audio network graphics window system)
to
find_package(SFML 2.4 REQUIRED COMPONENTS audio network graphics window system)
Cmake did not complain a bit about either change, said it had successfully found 2.4.2, and everyone was happy. I made sure too, that the SFML include directory was correct, and that the correct .dll files were listed.
When I compiled my library, everything went fine.
When I compiled my game, I got warnings that sf::Text.setColor() was deprecated, which seemed to me to indicate that the linking had worked.
Then, I got 40 undefined references.
I have tried everything I could find by googling, and haven't had success. Here are my cmake files:
JollyLava (my library)
project(JollyLava CXX)
cmake_minimum_required( VERSION 2.6 )
# Set version information in a config.h file
set(myproject_VERSION_MAJOR 0)
set(myproject_VERSION_MINOR 1)
# Name of this library.
set(LIBRARY_NAME "JollyLava")
#
# --- Our CMake settings
#
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})
# Place libraries in the root BUILD directory.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # static
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # dynamic
#
# --- Dependencies
#
# SFML
find_package(SFML 2.4 REQUIRED system window graphics network audio)
include_directories("${SFML_INCLUDE_DIR}")
# Box2D
find_package(Box2D REQUIRED)
include_directories("${BOX2D_INCLUDE_DIR}")
# Include headers.
include_directories(${CMAKE_SOURCE_DIR}/include)
# C++ source code.
add_subdirectory(src)
#
# --- Install
#
install(DIRECTORY include DESTINATION lib)
and JollyZorbit (my game)
project(JollyZorbit CXX)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})
#set(EXECUTABLE_NAME "JollyZorbit")
#add_executable(${EXECUTABLE_NAME} main.cpp)
find_package(JollyLava REQUIRED)
include_directories("${JOLLYLAVA_INCLUDE_DIR}")
find_package(SFML 2.4 REQUIRED audio network graphics window system)
include_directories("${SFML_INCLUDE_DIR}")
# Note - if I enable the following line I get the error "Cannot specify link libraries
# for target "debug" which is not built by this project"
#target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
find_package(Box2D REQUIRED)
#set(BOX2D_LIBRARY C:/Box2D_v2.2.1/build/Box2D/libBox2D.a)
#set(BOX2D_INCLUDE_DIR C:/Box2D_v2.2.1/)
include_directories("${BOX2D_INCLUDE_DIR}")
find_package(Steamworks REQUIRED)
include_directories(${STEAMWORKS_INCLUDE_DIR})
# Include headers.
include_directories(${CMAKE_SOURCE_DIR}/include)
# C++ source code.
add_subdirectory(src)
#set_property(TARGET JollyZorbit PROPERTY WIN32_EXECUTABLE true)
Does anyone have any thoughts on what is wrong? I am obviously quite a CMake newb, so please don't assume I know anything about what I'm doing.
Edit: Here's a little extra info:
http://imgur.com/a/o5kpe