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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - YigitHamza

Pages: [1]
1
General / Clion sfml Cmake error
« on: December 28, 2023, 03:39:27 pm »
i have an error setting up sfml on clion i have posted this before and eXpl0it3r 
told me to follow this tutorial here  is  the link https://edw.is/using-cmake/ i follow it and setup the sfml but
thre is a lot of errors here is the errors
====================[ Build | sogfremnmel | Debug ]=============================
"D:\JetBrains\CLion 2023.3.2\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\yigit\Desktop\projelerim\sogfremnmel\cmake-build-debug --target sogfremnmel -j 18
[0/1] Re-running CMake...
-- Found OpenGL: opengl32  found components: OpenGL
-- Fetching SFML...
CMake Deprecation Warning at cmake-build-debug/_deps/sfml-src/CMakeLists.txt:5 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:46 (add_library):
  add_library cannot create target "sfml-system" because another target with
  the same name already exists.  The existing target is a shared library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/System".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/System/CMakeLists.txt:89 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/System/CMakeLists.txt:99 (target_link_libraries):
  Attempt to add link library "winmm" to target "sfml-system" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:44 (add_library):
  add_library cannot create target "sfml-main" because another target with
  the same name already exists.  The existing target is a static library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/Main".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/Main/CMakeLists.txt:17 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:46 (add_library):
  add_library cannot create target "sfml-window" because another target with
  the same name already exists.  The existing target is a shared library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/Window".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:228 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:230 (target_link_libraries):
  Attempt to add link library "sfml-system" to target "sfml-window" which is
  not built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:258 (target_link_libraries):
  Attempt to add link library "OpenGL" to target "sfml-window" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:279 (target_link_libraries):
  Attempt to add link library "winmm" to target "sfml-window" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:46 (add_library):
  add_library cannot create target "sfml-graphics" because another target
  with the same name already exists.  The existing target is a shared library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/Graphics".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:93 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:97 (target_link_libraries):
  Attempt to add link library "sfml-window" to target "sfml-graphics" which
  is not built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:125 (target_link_libraries):
  Attempt to add link library "OpenGL" to target "sfml-graphics" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


-- Found OpenGL: opengl32  
CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:138 (target_link_libraries):
  Attempt to add link library "Freetype" to target "sfml-graphics" which is
  not built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


-- Configuring incomplete, errors occurred!
ninja: error: rebuilding &#39;build.ninja&#39;: subcommand failed
FAILED: build.ninja
maybe i did not do something i dont know i did what the tutorial says
thans for the help

2
General / Sfml and imgui with cmake and Clion
« on: December 24, 2023, 02:55:10 pm »
Hello i am a new developer  wants to learn sfml and imgui wits Cmake Clion i cant use imgui it gives error and the error says

====================[ Build | SFML | Debug ]====================================
"D:\JetBrains\CLion 2023.3.2\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\yigit\Desktop\projelerim\SFML\cmake-build-debug --target SFML -j 18
[1/1] Linking CXX executable SFML.exe
FAILED: SFML.exe and there is more line cmd.exe /C "cd . && C:\mingw64\bin\c++.exe -g  CMakeFiles/SFML.dir/main.cpp.obj -o SFML.exe -Wl,--out-implib,libSFML.dll.a -Wl,--major-image-version,0,--minor-image-version,0  C:/SFML/lib/libsfml-system-s-d.a  C:/SFML/lib/libsfml-window-s-d.a  C:/SFML/lib/libsfml-graphics-s-d.a  C:/SFML/lib/libsfml-audio-s-d.a  C:/SFML/lib/libsfml-window-s-d.a  -lOpenGL32  -lgdi32  C:/SFML/lib/libfreetype.a  C:/SFML/lib/libsfml-system-s-d.a  -lwinmm  C:/SFML/lib/libopenal32.a  C:/SFML/lib/libvorbisfile.a  C:/SFML/lib/libvorbisenc.a  C:/SFML/lib/libvorbis.a  C:/SFML/lib/libogg.a  C:/SFML/lib/libFLAC.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/SFML.dir/main.cpp.obj: in function `main&#39;:
C:/Users/yigit/Desktop/projelerim/SFML/main.cpp:9: undefined reference to `ImGui::SFML::Init(sf::RenderWindow&, bool)&#39;
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/yigit/Desktop/projelerim/SFML/main.cpp:22: undefined reference to `ImGui::SFML::ProcessEvent(sf::Event const&)&#39;
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/yigit/Desktop/projelerim/SFML/main.cpp:26: undefined reference to `ImGui::SFML::Update(sf::RenderWindow&, sf::Time)&#39;
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/yigit/Desktop/projelerim/SFML/main.cpp:30: undefined reference to `ImGui::SFML::Render(sf::RenderWindow&)&#39;
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/yigit/Desktop/projelerim/SFML/main.cpp:33: undefined reference to `ImGui::SFML::Shutdown()&#39;
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

the is a lot lines sorry my main Cmake codes
cmake_minimum_required(VERSION 3.27)
project(SFML)

set(CMAKE_CXX_STANDARD 17)

add_executable(SFML main.cpp)

set(SFML_STATIC_LIBRARIES TRUE)
set(SFML_DIR C:/SFML/lib/cmake/SFML)
find_package(SFML COMPONENTS system window graphics audio network REQUIRED)

include_directories(C:/SFML/include/SFML)
target_link_libraries(SFML sfml-system sfml-window sfml-graphics sfml-audio)
add_executable(Dynamic_2 ${CMAKE_CURRENT_SOURCE_DIR}/Main.cpp)
target_include_directories(
        SFML
        PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}/include
)

now there is my imgui file cmake codes

include(FetchContent)

set(SFML_VERSION 2.6.1)
set(IMGUI_VERSION 1.87)
#set(IMGUI_SFML_VERSION 2.6)

# It&#38;#39;s nice to get stripped-down release zips instead of cloning
# a repo and checking out a tag
FetchContent_Declare(
        SFML
        URL "https://github.com/SFML/SFML/archive/${SFML_VERSION}.zip"
)

FetchContent_Declare(
        imgui
        URL "https://github.com/ocornut/imgui/archive/v${IMGUI_VERSION}.zip"
)

# Or by tag...
FetchContent_Declare(
        imgui-sfml
        GIT_REPOSITORY https://github.com/SFML/imgui-sfml.git
        GIT_TAG        2.6.x
        # GIT_COMMIT 5f54b69b6aee18db846c81633f86f78c2586dded
        # ^ or like this - sometimes it&#38;#39;s better because FetchContent won&#38;#39;t look
        # into remote to see if branch head was updated or not - good for stable
        # tags like &#38;#39;vX.X&#38;#39; corresponding to releases
)

## finally, let&#38;#39;s build

# SFML
option(SFML_BUILD_AUDIO "Build audio" OFF)
option(SFML_BUILD_NETWORK "Build network" OFF)
FetchContent_MakeAvailable(sfml)

# Dear ImGui
FetchContent_MakeAvailable(ImGui)

# ImGui-SFML
set(ImGui)
option(ImGui_SFML_FIND_SFML "Use find_package to find SFML" OFF)
option(ImGui_SFML_ImGui_DEMO "Build imgui_demo.cpp" ON)

FetchContent_MakeAvailable(imgui-sfml)

i taked the cmake codes from an other forum  if you can help me i appreciate it sory for my english its not my main language


Pages: [1]