Gitea action trouble #1

Open
opened 2025-09-03 22:59:05 +02:00 by ParkSuMin · 0 comments
Owner

Так как разработка велась исключительно под Windows, то немудрено, что на Linux всё пошло через одно место (спасибо Actions). Поэтому необходимо пофиксить проблемы, выявленные на этапе сборки, а именно:

  • Добавить ifdef над _getch и заменить его UNIX-аналогом

  • Разобраться почему компилятор жалуется на std::max

Логи для понимания:

[ 25%] Building CXX object CMakeFiles/BattleCap.dir/src/BattleCap.cpp.o
[ 50%] Building CXX object CMakeFiles/BattleCap.dir/src/Game.cpp.o
/workspace/ParkSuMin/BattleCap/src/Game.cpp: In member function ‘void Game::info()’:
/workspace/ParkSuMin/BattleCap/src/Game.cpp:78:19: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’?
78 | int key = _getch();
| ^~~~~~
| wgetch
/workspace/ParkSuMin/BattleCap/src/Game.cpp: In member function ‘void Game::init()’:
/workspace/ParkSuMin/BattleCap/src/Game.cpp:113:21: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’?
113 | switch (_getch()) {
| ^~~~~~
| wgetch
/workspace/ParkSuMin/BattleCap/src/Game.cpp: In member function ‘void Game::play()’:
/workspace/ParkSuMin/BattleCap/src/Game.cpp:176:25: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’?
176 | switch (_getch()) {
| ^~~~~~
| wgetch
/workspace/ParkSuMin/BattleCap/src/Game.cpp:216:25: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’?
216 | switch (_getch()) {
| ^~~~~~
| wgetch
/workspace/ParkSuMin/BattleCap/src/Game.cpp:302:41: error: no matching function for call to ‘max()’
302 | const int max_val = std::max({ UP, DOWN, LEFT, RIGHT });
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/string:51,
from /workspace/ParkSuMin/BattleCap/include/Player.h:2,
from /workspace/ParkSuMin/BattleCap/include/Game.h:2,
from /workspace/ParkSuMin/BattleCap/src/Game.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template constexpr const _Tp& std::max(const _Tp&, const _Tp&)’
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
/workspace/ParkSuMin/BattleCap/src/Game.cpp:302:41: note: candidate expects 2 arguments, 1 provided
302 | const int max_val = std::max({ UP, DOWN, LEFT, RIGHT });
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed:
/workspace/ParkSuMin/BattleCap/src/Game.cpp:302:41: note: candidate expects 3 arguments, 1 provided
302 | const int max_val = std::max({ UP, DOWN, LEFT, RIGHT });
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/BattleCap.dir/build.make:90: CMakeFiles/BattleCap.dir/src/Game.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/BattleCap.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Failure - Main Build project
exitcode '2': failure

Так как разработка велась исключительно под Windows, то немудрено, что на Linux всё пошло через одно место (спасибо Actions). Поэтому необходимо пофиксить проблемы, выявленные на этапе сборки, а именно: - [ ] Добавить ifdef над _getch и заменить его UNIX-аналогом - [ ] Разобраться почему компилятор жалуется на std::max Логи для понимания: [ 25%] Building CXX object CMakeFiles/BattleCap.dir/src/BattleCap.cpp.o [ 50%] Building CXX object CMakeFiles/BattleCap.dir/src/Game.cpp.o /workspace/ParkSuMin/BattleCap/src/Game.cpp: In member function ‘void Game::info()’: /workspace/ParkSuMin/BattleCap/src/Game.cpp:78:19: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’? 78 | int key = _getch(); | ^~~~~~ | wgetch /workspace/ParkSuMin/BattleCap/src/Game.cpp: In member function ‘void Game::init()’: /workspace/ParkSuMin/BattleCap/src/Game.cpp:113:21: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’? 113 | switch (_getch()) { | ^~~~~~ | wgetch /workspace/ParkSuMin/BattleCap/src/Game.cpp: In member function ‘void Game::play()’: /workspace/ParkSuMin/BattleCap/src/Game.cpp:176:25: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’? 176 | switch (_getch()) { | ^~~~~~ | wgetch /workspace/ParkSuMin/BattleCap/src/Game.cpp:216:25: error: ‘_getch’ was not declared in this scope; did you mean ‘wgetch’? 216 | switch (_getch()) { | ^~~~~~ | wgetch /workspace/ParkSuMin/BattleCap/src/Game.cpp:302:41: error: no matching function for call to ‘max(<brace-enclosed initializer list>)’ 302 | const int max_val = std::max({ UP, DOWN, LEFT, RIGHT }); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/string:51, from /workspace/ParkSuMin/BattleCap/include/Player.h:2, from /workspace/ParkSuMin/BattleCap/include/Game.h:2, from /workspace/ParkSuMin/BattleCap/src/Game.cpp:1: /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: /workspace/ParkSuMin/BattleCap/src/Game.cpp:302:41: note: candidate expects 2 arguments, 1 provided 302 | const int max_val = std::max({ UP, DOWN, LEFT, RIGHT }); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: /workspace/ParkSuMin/BattleCap/src/Game.cpp:302:41: note: candidate expects 3 arguments, 1 provided 302 | const int max_val = std::max({ UP, DOWN, LEFT, RIGHT }); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/BattleCap.dir/build.make:90: CMakeFiles/BattleCap.dir/src/Game.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/BattleCap.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 ❌ Failure - Main Build project exitcode '2': failure
ParkSuMin added the
Kind/Bug
Priority
Medium
3
labels 2025-09-03 23:01:22 +02:00
Sign in to join this conversation.
No description provided.