it still doesn't work. Can you help me a little bit more? I don't really know what to do.
//CMakeList.txt
cmake_minimum_required(VERSION 3.15)
project(prova1)
set(CMAKE_CXX_STANDARD 14)
## If you want to link SFML statically
set(SFML_STATIC_LIBRARIES TRUE)
## In most cases better set in the CMake cache
set(SFML_DIR "D:/Libraries/SFML/lib/cmake/SFML")
find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
add_executable(prova1 main.cpp)
target_link_libraries(prova1 sfml-graphics sfml-audio)
//main.cpp
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(640,480,32),"Hello SFML");
sf::Font font;
font.loadFromFile("resources/fonts/Pacifico.ttf");
sf::Text text("Hello World",font,11);
text.setCharacterSize(32);
text.setPosition(window.getSize().x/2 - text.getGlobalBounds().width/2,
window.getSize().y/2 - text.getGlobalBounds().height/2);
while(window.isOpen()){
sf::Event event;
while(window.pollEvent(event)) {
if(event.type == sf::Event::Closed){
window.close();
}
window.clear(sf::Color::Black);
window.draw(text);
window.display();
}
}
return 0;
}
//cMake
"C:\Program Files\JetBrains\CLion 2019.2.4\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\cristina\CLionProjects\prova1
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found SFML 2.5.1 in D:/Libraries/SFML/lib/cmake/SFML
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/cristina/CLionProjects/prova1/cmake-build-debug
[Finished]
====================[ Build | prova1 | Debug ]==================================
"C:\Program Files\JetBrains\CLion 2019.2.4\bin\cmake\win\bin\cmake.exe" --build C:\Users\cristina\CLionProjects\prova1\cmake-build-debug --target prova1 -- -j 2
Scanning dependencies of target prova1
[ 50%] Building CXX object CMakeFiles/prova1.dir/main.cpp.obj
[100%] Linking CXX executable prova1.exe
CMakeFiles\prova1.dir/objects.a(main.cpp.obj): In function `main':
C:/Users/cristina/CLionProjects/prova1/main.cpp:6: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:6: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:6: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:8: undefined reference to `sf::Font::Font()'
C:/Users/cristina/CLionProjects/prova1/main.cpp:9: undefined reference to `sf::Font::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:11: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:11: undefined reference to `sf::Text::Text(sf::String const&, sf::Font const&, unsigned int)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:12: undefined reference to `sf::Text::setCharacterSize(unsigned int)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:14: undefined reference to `sf::RenderWindow::getSize() const'
C:/Users/cristina/CLionProjects/prova1/main.cpp:14: undefined reference to `sf::Text::getGlobalBounds() const'
C:/Users/cristina/CLionProjects/prova1/main.cpp:13: undefined reference to `sf::RenderWindow::getSize() const'
C:/Users/cristina/CLionProjects/prova1/main.cpp:13: undefined reference to `sf::Text::getGlobalBounds() const'
C:/Users/cristina/CLionProjects/prova1/main.cpp:14: undefined reference to `sf::Transformable::setPosition(float, float)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:17: undefined reference to `sf::Window::isOpen() const'
C:/Users/cristina/CLionProjects/prova1/main.cpp:20: undefined reference to `sf::Window::pollEvent(sf::Event&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:22: undefined reference to `sf::Window::close()'
C:/Users/cristina/CLionProjects/prova1/main.cpp:25: undefined reference to `sf::Color::Black'
C:/Users/cristina/CLionProjects/prova1/main.cpp:25: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:26: undefined reference to `sf::RenderStates::Default'
C:/Users/cristina/CLionProjects/prova1/main.cpp:26: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
C:/Users/cristina/CLionProjects/prova1/main.cpp:27: undefined reference to `sf::Window::display()'
C:/Users/cristina/CLionProjects/prova1/main.cpp:8: undefined reference to `sf::Font::~Font()'
C:/Users/cristina/CLionProjects/prova1/main.cpp:6: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/Users/cristina/CLionProjects/prova1/main.cpp:8: undefined reference to `sf::Font::~Font()'
C:/Users/cristina/CLionProjects/prova1/main.cpp:6: undefined reference to `sf::RenderWindow::~RenderWindow()'
CMakeFiles\prova1.dir/objects.a(main.cpp.obj): In function `ZN2sf11VertexArrayD1Ev':
D:/Libraries/SFML/include/SFML/Graphics/VertexArray.hpp:45: undefined reference to `vtable for sf::VertexArray'
CMakeFiles\prova1.dir/objects.a(main.cpp.obj): In function `ZN2sf4TextD1Ev':
D:/Libraries/SFML/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
D:/Libraries/SFML/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
D:/Libraries/SFML/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::Transformable::~Transformable()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [prova1.exe] Error 1
CMakeFiles\prova1.dir\build.make:96: recipe for target 'prova1.exe' failed
CMakeFiles\Makefile2:74: recipe for target 'CMakeFiles/prova1.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/prova1.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/prova1.dir/rule] Error 2
CMakeFiles\Makefile2:81: recipe for target 'CMakeFiles/prova1.dir/rule' failed
Makefile:117: recipe for target 'prova1' failed
mingw32-make.exe: *** [prova1] Error 2