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

Author Topic: header file not found error(Mac/CLion/SFML 2.5.1 ver)  (Read 2162 times)

0 Members and 1 Guest are viewing this topic.

Heather

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
header file not found error(Mac/CLion/SFML 2.5.1 ver)
« on: January 06, 2019, 07:28:41 am »
Hi I'm a CLion user on Mac and I just downloaded the latest version of SFML(2.5.1).
I've been struggling running the example files for more than five hours.
I tried almost every thing on the internet and I can't find how to run this on Mac/CLion/SFML 2.5.1 version.
Please can you help me run this?

I'm trying to run the Window.cpp file in the example file when you download the 2.5.1 SFML.
Here's my CMakeLists.txt

cmake_minimum_required(VERSION 3.12)
project(window)

set(CMAKE_CXX_STANDARD 14)
include_directories(./Downloads/SFML-2.5.1-macos-clang/include/SFML) // I'm not sure if it's right.
add_executable(window
        Window.cpp)

Problem is error kept saying that "fatal error: 'SFML/Window.hpp' file not found"

When I added these two lines
find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
target_link_libraries(window SFML::graphics SFML::audio)

This error came out
"CMake Error at CMakeLists.txt:5 (find_package):
  By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SFML", but
  CMake did not find one.

  Could not find a package configuration file provided by "SFML" (requested
  version 2.5) with any of the following names:

    SFMLConfig.cmake
    sfml-config.cmake

  Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or set
  "SFML_DIR" to a directory containing one of the above files.  If "SFML"
  provides a separate development package or SDK, be sure it has been
  installed."

Please help me...

Thank you so much.
« Last Edit: January 06, 2019, 07:37:56 am by Heather »

Heather

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: header file not found error(Mac/CLion/SFML 2.5.1 ver)
« Reply #1 on: January 06, 2019, 08:44:47 am »
I just found out that I needed to copy files into my folders.
I can't remove this post.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: header file not found error(Mac/CLion/SFML 2.5.1 ver)
« Reply #2 on: January 06, 2019, 02:34:44 pm »
Not sure what files you think need to be copied, but your CMake setup is outdated, see the migration thread instead: https://en.sfml-dev.org/forums/index.php?topic=24070.0
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/