-
Hello! Thank you for making and uploading a template for us beginners! My only question is how can we build it on windows and cmake? :( |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hi @ybtre ! Good question, I realize I should have added some instruction about this in the README 🤔 I'll suppose you don't have anything installed on your PC: no C toolchain, no CMake, no IDE.. I suggest you use the Scoop package manager to install all the necessary dependencies. To do so, install Scoop by following the instructions on the website and then open a terminal and: # install cmake and c compiler toolchain
scoop install cmake gcc Once the installation finishes you should have everything you need to build and run this repo. You could do it from the command line but if you're just starting then I suggest you don't go through that route, at least not initially, and instead work with an IDE that handles all the building and running commands for you. I've found VSCode to be really good for C/C++ development, so I'll suppose you're going to use that as well. Once you install VSCode on your PC, install the C/C++ tools extension, which is what will actually enable the IDE to manage the CMake project for you. With the extension installed now you can open the repo in VSCode (btw, make sure to pull the latest changes, I uploaded a change just when I was writing this that fixes an issue with CMake sometimes not finding the dependencies to download). The first thing you'll want to do is tell VSCode which C compiler you want to use. You can do this by clicking on the label And that's it! It should be more than enough to get you started and play with the code. Let me know if you encounter any issues or if you want me to elaborate more in detail about any of the points above |
Beta Was this translation helpful? Give feedback.
-
This is the output tab after I deleted the build folder and pressed build in vs code using gcc 12.2.0 Output
and this is the CMake: Configure output Cmake: configure log``` [main] Configuring project: raylib-cpp-cmake-template [proc] Executing command: C:\Users\hristo.vuchev\scoop\shims\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\mingw64\bin\g++.exe -SC:/Users/hristo.vuchev/Documents/WorkVerse/PongProject/raylib-cpp-cmake-template -Bc:/Users/hristo.vuchev/Documents/WorkVerse/PongProject/raylib-cpp-cmake-template/build -G "MinGW Makefiles" [cmake] Not searching for unused variables given on the command line. [cmake] -- Testing if -Werror=pointer-arith can be used -- compiles [cmake] -- Testing if -Werror=implicit-function-declaration can be used -- compiles [cmake] -- Testing if -fno-strict-aliasing can be used -- compiles [cmake] -- Using raylib's GLFW [cmake] -- Using Win32 for window creation [cmake] -- Audio Backend: miniaudio [cmake] -- Building raylib static library [cmake] -- Generated build type: Debug [cmake] -- Compiling with the flags: [cmake] -- PLATFORM=PLATFORM_DESKTOP [cmake] -- GRAPHICS=GRAPHICS_API_OPENGL_33 [cmake] -- Module support is disabled. [cmake] -- Version: 9.1.0 [cmake] -- Build type: Debug [cmake] -- CXX_STANDARD: 17 [cmake] -- Required features: cxx_variadic_templates [cmake] -- Configuring done [cmake] -- Generating done [cmake] -- Build files have been written to: C:/Users/hristo.vuchev/Documents/WorkVerse/PongProject/raylib-cpp-cmake-template/build ```I am not sure where my std library is supposed to be, should be the default install location chosen by MSVS 2022, I havent installed/added them manually through scoop/vcpkg/choco ;/ Thank you for taking the time and try and help to sort the issue out, obviously its an issue with my windows/setup. Im planning on doing a fresh install on my laptop over the weekend and will try it there as well |
Beta Was this translation helpful? Give feedback.
-
Hey, update after the weekend :D After reinstalling my home pc and cloning the template from scratch (while installing cmake, gcc, vscode and ninja through scoop) - everything ran without an issue! Today on my work laptop where I was originally getting the errors I noticed I didn't have ninja installed. After installing ninja and switching to gcc 11.2 I no longer get errors and can build successfully! I would recommend adding these 4 things in the readme as a prerequisite - cmake, gcc, ninja and vscode for anyone else wanting to use the template the wonderful template! Thank you so much for taking the time to respond and debug this issue with me! As a side comment, do you think it would be possible to extend the template with support for building to web. not just windows? That way people can use the template to share their game to their friends through itch easily :) (and sadly i'm still fighting my way through learning how cmake/premake work :( ) |
Beta Was this translation helpful? Give feedback.
Hey, update after the weekend :D After reinstalling my home pc and cloning the template from scratch (while installing cmake, gcc, vscode and ninja through scoop) - everything ran without an issue!
Today on my work laptop where I was originally getting the errors I noticed I didn't have ninja installed. After installing ninja and switching to gcc 11.2 I no longer get errors and can build successfully!
I would recommend adding these 4 things in the readme as a prerequisite - cmake, gcc, ninja and vscode for anyone else wanting to use the template the wonderful template!
Thank you so much for taking the time to respond and debug this issue with me!
As a side comment, do you think it would b…