lefticus / cpp_weekly_game_project Goto Github PK
View Code? Open in Web Editor NEWLicense: The Unlicense
License: The Unlicense
There's an error with MSVC when compiling without the /experimental:module flag.
Will not compile due to the following code being unstupported by MSVC:
constexpr std::array steps = { "The Plan",
"Getting Started",
"Finding Errors As Soon As Possible",
"Handling Command Line Parameters",
"C++ 20 So Far",
"Reading SFML Input States",
"Managing Game State",
"Making Our Game Testable",
"Making Game State Allocator Aware",
"Add Logging To Game Engine",
"Draw A Game Map",
"Dialog Trees",
"Porting From SFML To SDL" };
If I enable the PCH options in cmake then building the project fails. Any idea how can I get rid of this error? I tried to look into cmake documentation and it looks like there should be a way to exclude the "test" folder from being a target for precompiled headers?
saya@sayavbox:~/Work/cpp_base_project/build$ make
[ 6%] Building CXX object test/CMakeFiles/catch_main.dir/catch_main.cpp.o
error: file '/home/saya/Work/cpp_base_project/build/test/CMakeFiles/catch_main.dir/cmake_pch.hxx.gch' is not a valid precompiled PCH file [clang-diagnostic-error]
error: input is not a PCH file: '/home/saya/Work/cpp_base_project/build/test/CMakeFiles/catch_main.dir/cmake_pch.hxx.gch' [clang-diagnostic-error]
1 warning and 3 errors generated.
Error while processing /home/saya/Work/cpp_base_project/test/catch_main.cpp.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
make[2]: *** [test/CMakeFiles/catch_main.dir/build.make:79: test/CMakeFiles/catch_main.dir/catch_main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:230: test/CMakeFiles/catch_main.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
Hi, thanks for creating this project :)
When I run it I find that I get an undefined reference to pthread_cond_clockwait
, is that expected?
[build] : && /usr/bin/g++-10 -g src/CMakeFiles/game.dir/main.cpp.o -o bin/game /home/luke/.conan/data/docopt.cpp/0.6.2/_/_/package/a25d6c83542b56b72fdaa05a85db5d46f5f0f71c/lib/libdocopt.a /home/luke/.conan/data/spdlog/1.5.0/_/_/package/270d3115ab09f4c4851a4e1dfbd2e97254780788/lib/libspdlogd.a /home/luke/.conan/data/fmt/6.1.2/_/_/package/a25d6c83542b56b72fdaa05a85db5d46f5f0f71c/lib/libfmtd.a /home/luke/.conan/data/imgui-sfml/2.1/bincrafters/stable/package/26d23aa8d062ea50e48525fca93bada6371cc813/lib/libImGui-SFML.a /home/luke/.conan/data/sfml/2.5.1/bincrafters/stable/package/5fcbbf7899412c7de0f4dc642726af721eb1aa64/lib/libsfml-graphics-s-d.a /home/luke/.conan/data/sfml/2.5.1/bincrafters/stable/package/5fcbbf7899412c7de0f4dc642726af721eb1aa64/lib/libsfml-window-s-d.a /home/luke/.conan/data/sfml/2.5.1/bincrafters/stable/package/5fcbbf7899412c7de0f4dc642726af721eb1aa64/lib/libsfml-network-s-d.a /home/luke/.conan/data/sfml/2.5.1/bincrafters/stable/package/5fcbbf7899412c7de0f4dc642726af721eb1aa64/lib/libsfml-audio-s-d.a /home/luke/.conan/data/sfml/2.5.1/bincrafters/stable/package/5fcbbf7899412c7de0f4dc642726af721eb1aa64/lib/libsfml-system-s-d.a -ludev /home/luke/.conan/data/freetype/2.10.1/_/_/package/15d0321972b5e07c6dffc7b81c9224fcbdebf3eb/lib/libfreetyped.a /home/luke/.conan/data/libpng/1.6.37/_/_/package/a9fe3d6db2abc8480b10cfc66fa935ac6c5fb2d9/lib/libpng16d.a /home/luke/.conan/data/zlib/1.2.11/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libz.a /home/luke/.conan/data/bzip2/1.0.8/_/_/package/9f84c49e2143828a044b1675a587477e091c9f9f/lib/libbz2.a /home/luke/.conan/data/openal/1.19.1/_/_/package/3418f7f86a43044f8b37fb3bceed708073c22c1d/lib/libopenal.a /home/luke/.conan/data/libalsa/1.2.4/_/_/package/306572d895c5474147e10589af98380c0fc47cb0/lib/libasound.a -ldl -lrt -lpthread /home/luke/.conan/data/flac/1.3.3/_/_/package/93e346d7049e757d6898188f1a3aa8a360d72813/lib/libFLAC++.a /home/luke/.conan/data/flac/1.3.3/_/_/package/93e346d7049e757d6898188f1a3aa8a360d72813/lib/libFLAC.a /home/luke/.conan/data/vorbis/1.3.6/_/_/package/34efbd5c7d1ab93bae5455413ea47cc3e3702def/lib/libvorbisenc.a /home/luke/.conan/data/vorbis/1.3.6/_/_/package/34efbd5c7d1ab93bae5455413ea47cc3e3702def/lib/libvorbisfile.a /home/luke/.conan/data/vorbis/1.3.6/_/_/package/34efbd5c7d1ab93bae5455413ea47cc3e3702def/lib/libvorbis.a -lm /home/luke/.conan/data/ogg/1.3.4/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libogg.a -lX11 -lX11-xcb -lxcb -lfontenc -lICE -lSM -lXau -lXaw7 -lXt -lXcomposite -lXcursor -lXdamage -lXfixes -lXdmcp -lXext -lXft -lXi -lXinerama -lxkbfile -lXmu -lXmuu -lXpm -lXrandr -lXrender -lXRes -lXss -lXtst -lXv -lXvMC -lXxf86vm -lxcb-xkb -lxcb-icccm -lxcb-image -lxcb-shm -lxcb-keysyms -lxcb-randr -lxcb-render -lxcb-render-util -lxcb-shape -lxcb-sync -lxcb-xfixes -lxcb-xinerama -lxcb-util -lxcb-dri3 -lGL && :
[build] /home/luke/.conan/data/spdlog/1.5.0/_/_/package/270d3115ab09f4c4851a4e1dfbd2e97254780788/lib/libspdlogd.a(async.cpp.o): In function `std::cv_status std::condition_variable::__wait_until_impl<std::chrono::duration<long, std::ratio<1l, 1000000000l> > >(std::unique_lock<std::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&)':
[build] /usr/include/c++/10/condition_variable:209: undefined reference to `pthread_cond_clockwait'
I have switched to a fresh install of Ubuntu 18.04 LTS and getting the error:
ERROR: Recipe not found: 'spdlog/1.5.0'
Conan is working as it downloaded other libraries but for some reason it can't find spdlog. I verified that the conan website has 1.5.0 as the latest version.
Any ideas what might be the problem?
Here is the complete error:
/snap/clion/103/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/jeff/projects/cpp_weekly_game_project
ccache not found cannot use
-- Conan: checking conan executable
-- Conan: Found program /home/jeff/.local/bin/conan
-- Conan: Version found Conan version 1.23.0
-- Conan: Adding bincrafters remote repository (https://api.bintray.com/conan/bincrafters/public-conan)
-- Conan: Automatic detection of conan settings from cmake
-- Conan: Settings= -s;build_type=Debug;-s;compiler=gcc;-s;compiler.version=7;-s;compiler.libcxx=libstdc++11
-- Conan: checking conan executable
-- Conan: Found program /home/jeff/.local/bin/conan
-- Conan: Version found Conan version 1.23.0
-- Conan executing: /home/jeff/.local/bin/conan install . -s build_type=Debug -s compiler=gcc -s compiler.version=7 -s compiler.libcxx=libstdc++11 -g=cmake --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
fmt/6.1.2: Not found in local cache, looking in remotes...
fmt/6.1.2: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
fmt/6.1.2: Downloaded recipe revision 0
ERROR: Recipe not found: 'spdlog/1.5.0'
CMake Error at cmake-build-debug/conan.cmake:402 (message):
Conan install failed='1'
Call Stack (most recent call first):
cmake-build-debug/conan.cmake:497 (conan_cmake_install)
cmake/Conan.cmake:16 (conan_cmake_run)
CMakeLists.txt:57 (run_conan)
-- Configuring incomplete, errors occurred!
See also "/home/jeff/projects/cpp_weekly_game_project/cmake-build-debug/CMakeFiles/CMakeOutput.log".
[Finished]
I am on a fresh install of ubuntu with CMake and conan installed.
I get the error:
stb/20180214@conan/stable is locked by another concurrent conan process, wait...
No matter what I do when CLion loads the project. I have tried doing:
conan remove --locks
and even:
conan remove "*" -f
restarting CLion and even rebooting my computer, but I always get the error:
stb/20180214@conan/stable is locked by another concurrent conan process, wait...
This has been driving me crazy! Any idea how to fix this?
I think the README should be updated to reflect the current status of this project.
Right now, the README says you can build the project with gcc-7 and clang-6; this certainly isn't true.
I think the Optional Dependencies section should be cut down a lot and merged into the Required Dependencies section.
Also, most of our badges now point to the cpp_starter_project CI builds; they should point to this project.
/home/julien/.conan/data/spdlog/1.5.0/_/_/package/9df34d57e1d38147409e41fa69c20cd1153df23b/lib/libspdlogd.a(spdlog.cpp.o): In function `fmt::v6::internal::is_integral_type(fmt::v6::internal::type)':
/tmp/c3ipr/pr_961_6_4_37/.conan/data/fmt/6.1.2/_/_/package/038baac88f4c7bfa972ce5adac1616bed8fe2ef4/include/fmt/core.h:736: undefined reference to `fmt::v6::internal::assert_fail(char const*, int, char const*)'
When conan runs I get a warning WARN: spdlog/1.5.0: requirement fmt/6.1.2 overridden by your conanfile to fmt/6.0.0
Upgrading to fmt/6.1.2 solves the problem.
On Ubuntu 18.04, gcc-9
I am on a mac and having trouble compiling. I needed to implement @lsarkisov PR (#1) and I was able to compile.
Now I am having a linker error and I have no idea what this means:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/jeff/projects/personal/cpp_weekly_game_project/cmake-build-debug --target game -- -j 6
[ 50%] Linking CXX executable ../bin/game
Undefined symbols for architecture x86_64:
"fmt::v6::internal::basic_data<void>::signs", referenced from:
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<float, 0>(float, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::nonfinite_writer<char>::operator()<char*>(char*&&) const in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::nonfinite_writer<char>::operator()<char*&>(char*&) const in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::float_writer<char>::operator()<char*>(char*&&) in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::float_writer<char>::operator()<char*&>(char*&) in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<double, 0>(double, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<long double, 0>(long double, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
...
"fmt::v6::internal::assert_fail(char const*, int, char const*)", referenced from:
fmt::v6::basic_memory_buffer<char, 250ul, std::__1::allocator<char> >::operator=(fmt::v6::basic_memory_buffer<char, 250ul, std::__1::allocator<char> >&&) in libspdlogd.a(spdlog.cpp.o)
std::__1::make_unsigned<long>::type fmt::v6::internal::to_unsigned<long>(long) in libspdlogd.a(spdlog.cpp.o)
char const* fmt::v6::internal::parse_arg_id<char, fmt::v6::internal::id_adapter<fmt::v6::format_handler<fmt::v6::arg_formatter<fmt::v6::buffer_range<char> >, char, fmt::v6::basic_format_context<std::__1::back_insert_iterator<fmt::v6::internal::buffer<char> >, char> >&, char> >(char const*, char const*, fmt::v6::internal::id_adapter<fmt::v6::format_handler<fmt::v6::arg_formatter<fmt::v6::buffer_range<char> >, char, fmt::v6::basic_format_context<std::__1::back_insert_iterator<fmt::v6::internal::buffer<char> >, char> >&, char>&&) in libspdlogd.a(spdlog.cpp.o)
decltype(fp(0)) fmt::v6::visit_format_arg<fmt::v6::arg_formatter<fmt::v6::buffer_range<char> >, fmt::v6::basic_format_context<std::__1::back_insert_iterator<fmt::v6::internal::buffer<char> >, char> >(fmt::v6::arg_formatter<fmt::v6::buffer_range<char> >&&, fmt::v6::basic_format_arg<fmt::v6::basic_format_context<std::__1::back_insert_iterator<fmt::v6::internal::buffer<char> >, char> > const&) in libspdlogd.a(spdlog.cpp.o)
fmt::v6::internal::arg_formatter_base<fmt::v6::buffer_range<char>, fmt::v6::internal::error_handler>::operator()(fmt::v6::monostate) in libspdlogd.a(spdlog.cpp.o)
std::__1::make_unsigned<int>::type fmt::v6::internal::to_unsigned<int>(int) in libspdlogd.a(spdlog.cpp.o)
unsigned int fmt::v6::internal::format_decimal<char, unsigned int, char*, char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::'lambda'(char*)>(unsigned int, char*, int, char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::'lambda'(char*)) in libspdlogd.a(spdlog.cpp.o)
...
"int fmt::v6::internal::format_float<double>(double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)", referenced from:
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<float, 0>(float, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<double, 0>(double, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
"int fmt::v6::internal::format_float<long double>(long double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)", referenced from:
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<long double, 0>(long double, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > fmt::v6::internal::grouping_impl<char>(fmt::v6::internal::locale_ref)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > fmt::v6::internal::grouping<char>(fmt::v6::internal::locale_ref) in libspdlogd.a(spdlog.cpp.o)
"int fmt::v6::internal::snprintf_float<double>(double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)", referenced from:
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<float, 0>(float, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<double, 0>(double, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
"int fmt::v6::internal::snprintf_float<long double>(long double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)", referenced from:
void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<long double, 0>(long double, fmt::v6::basic_format_specs<char>) in libspdlogd.a(spdlog.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [bin/game] Error 1
make[2]: *** [src/CMakeFiles/game.dir/all] Error 2
make[1]: *** [src/CMakeFiles/game.dir/rule] Error 2
make: *** [game] Error 2
Any ideas?
Hello, I am coming from embedded C, I just started learning C++, so maybe this question is going far ahead or even sound stupid to veteran C++ devs. I know that the purpose of the checkbox is to see the progress of the weekly episodes so it is a pretty simple solution to do that but, if we would like to optimize the solution, does the following make sense:
If I understand properly the bool type is taking up a byte in the memory.
If we would like to optimize from the side of memory, would it be better to use bit fields(i am not sure if this is the way to go with C++20), or bitsets/dynamic_bitsets. But yes this would have to be casted into a bool.
Example:
typedef struct t
{
uint16_t State:1;
uint16_t State1:1;
uint16_t State2:1;
uint16_t State3:1;
uint16_t State4:1;
uint16_t State5:1;
uint16_t State6:1;
uint16_t State7:1;
uint16_t State8:1;
uint16_t State9:1;
uint16_t State10:1;
}CheckBox_Status;
Thank you for doing this tutorial series.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.