dimi309 / small3d-boilerplate

Boilerplate code for building cross-platform games with small3d
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Build error small3d/Sound.hpp:185:23: error: ‘uint32_t’ has not been declared #1

Closed iamn1ck closed 1 year ago

iamn1ck commented 1 year ago

I just discovered this project and tried building it to test it out. However after following the build instructions in the readme I get 2 build errors

/home/n1ck/.conan2/p/b/small03510660bf00a/b/include/small3d/Sound.hpp:185:23: error: ‘uint32_t’ has not been declared
  185 |     void divideVolume(uint32_t divisor);
      |                       ^~~~~~~~
/home/n1ck/.conan2/p/b/small03510660bf00a/b/src/Sound.cpp:543:8: error: no declaration matches ‘void small3d::Sound::divideVolume(uint32_t)’
  543 |   void Sound::divideVolume(uint32_t divisor) {
dimi309 commented 1 year ago

Hello!

Sorry about that! I usually test this project on Windows, MacOS and Ubuntu and Debian Linux, where it seems to work fine for the moment. Could you give me a bit of information about your system (for example operating system, if you are using linux which distribution and if you are on 64 or 32 bits)? I will then try to reproduce and fix the error.

iamn1ck commented 1 year ago

Hi,

I am running Arch linux (64 bit), I had to install a few dependencies before I could build (conan, python colorama, etc). I made it to the last step before running the game conan build . --build=missing

The remaining error message is

make[2]: *** [src/CMakeFiles/small3d.dir/build.make:216: src/CMakeFiles/small3d.dir/Sound.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:98: src/CMakeFiles/small3d.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

small3d/master: ERROR: 
Package '631db687a630a68005b924f2048207068b892816' build failed
small3d/master: WARN: Build folder /home/n1ck/.conan2/p/b/small6f4abc330d145/b/build/Release
*********************************************************
Recipe 'small3d/master' cannot build its binary
It is possible that this recipe is not Conan 2.0 ready
If the recipe comes from ConanCenter check: https://conan.io/cci-v2.html
If it is your recipe, check if it is updated to 2.0
*********************************************************

ERROR: small3d/master: Error in build() method, line 48
        cmake.build()
        ConanException: Error 2 while executing

Thanks for your support

dimi309 commented 1 year ago

There still seems to be something wrong with Sound.cpp up there... In case it is some cached problem, perhaps try to do a conan remove small3d and conan remove portaudio. Then export these packages again as mentioned in the readme (running conan export from their repositories) and clean the boilerplate repo (git clean -fdx) before running the build. If the error persists could you send me the entire build log? (even above the Sound.o error line) I do not know how soon I will manage to do it but I will try to install arch linux in the meantime and run the build myself. Indeed, I'd like to make sure the project runs on arch linux as well, so thanks again for raising this issue!

iamn1ck commented 1 year ago

I ran the conan remove commands and exported them again; as well as the git clean command but the problem persists. I doubt it is a cache issue as I have never built these project, nor had conan installed on my system before today.

Here is the full output from the build command out.txt

dimi309 commented 1 year ago

Ok, I've fixed it. I just had to add an #include <cstdint> in Sound.hpp. I am not 100% sure why it is only on Arch that this is needed. I have found this old discussion that gave me the idea of what I should do: https://stackoverflow.com/questions/11069108/uint32-t-does-not-name-a-type You do not need to pull anything to get this fix. It is in a commit of the small3d repository. It will be downloaded and deployed on your machine automatically as long as you: 1) remove the small3d package: conan remove small3d 2) export it again from the small3d-conan repository:

cd small3d-conan
conan export .

3) And then build small3d-boilerplate again:

cd small3d-boilerplate
conan build . --build=missing

Once built and executed, the boilerplate will start a game loop that might go full screen and you might get the impression that it is stuck, but it will not be. You would need to program the logic to terminate the "game". For now one way to exit it is to press alt+tab to go back to your terminal screen and then press ctrl-c.

I hope this helps. Please do not hesitate to write back if you need any more help.