[main] Building folder: sfml-cmake all
[build] Starting build
[proc] Executing command: D:\Prgrams\CMake\bin\cmake.EXE --build d:/VcProj/sfml-cmake/build --config Debug --target all --
[build] [1/2 50% :: 1.086] Building CXX object CMakeFiles/main.dir/src/main.cpp.obj
[build] [2/2 100% :: 2.083] Linking CXX executable bin\main.exe
[build] FAILED: bin/main.exe
[build] C:\WINDOWS\system32\cmd.exe /C "C:\WINDOWS\system32\cmd.exe /C "cd /D D:\VcProj\sfml-cmake\build && D:\Prgrams\CMake\bin\cmake.exe -E copy D:/VcProj/sfml-cmake/build/_deps/sfml-src/extlibs/bin/x64/openal32.dll D:/VcProj/sfml-cmake/build/bin && cd D:\VcProj\sfml-cmake\build" && C:\msys64\ucrt64\bin\c++.exe -g CMakeFiles/main.dir/src/main.cpp.obj -o bin\main.exe -Wl,--out-implib,libmain.dll.a -Wl,--major-image-version,0,--minor-image-version,0 _deps/sfml-build/lib/libsfml-graphics-s-d.a _deps/sfml-build/lib/libsfml-window-s-d.a _deps/sfml-build/lib/libsfml-system-s-d.a -lopengl32 -lwinmm -lgdi32 _deps/sfml-src/extlibs/libs-mingw/x64/libfreetype.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
[build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/main.dir/src/main.cpp.obj: in function `main':
[build] D:/VcProj/sfml-cmake/src/main.cpp:9: undefined reference to `Game::update()'
[build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/VcProj/sfml-cmake/src/main.cpp:10: undefined reference to `Game::render()'
[build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/VcProj/sfml-cmake/src/main.cpp:7: undefined reference to `Game::isRunning()'
[build] collect2.exe: error: ld returned 1 exit status
[build] ninja: build stopped: subcommand failed.
[proc] The command: D:\Prgrams\CMake\bin\cmake.EXE --build d:/VcProj/sfml-cmake/build --config Debug --target all -- exited with code: 1
[driver] Build completed: 00:00:02.171
[build] Build finished with exit code 1
#include "game.h"
int main()
{
Game game;
while(game.isRunning())
{
game.update();
game.render();
}
}
If you want to add or remove any .cpp files, change the source files listed in the add_executable call in CMakeLists.txt to match the source files your project requires. If you plan on keeping the default main.cpp file then no changes are required.