Recently, my team and I started to not be able to compile our code, even though, as far as I know, nothing should have caused these errors. I have tried to solve these errors, but to no avail. These are the errors:
from ./include/okapi/impl/device/motor/motorGroup.hpp:9,
from ./include/skidSteeringChassisSubsystem.hpp:2,
from ./include/skidDriveLib.hpp:6,
from src/skidDriveLib.cpp:2
./include/okapi/api/util/mathUtil.hpp:210:11: error: 'decl-specifier' in declaration of deduction guide
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~
./include/okapi/api/util/mathUtil.hpp:210:1: error: 'decl-specifier' in declaration of deduction guide
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~~~~~~
./include/okapi/api/util/mathUtil.hpp:210:11: error: 'long' specified with 'modulus<...auto...>'
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~
./include/okapi/api/util/mathUtil.hpp:210:16: error: deduction guide for 'std::modulus<_Tp>' must have trailing return type
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
|
In file included from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\string:48,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\bits\locale_classes.h:40,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\bits\ios_base.h:41,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\ios:42,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\ostream:38,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\iostream:39,
from ./include/api.h:30,
from ./include/odometrySubsystem.hpp:2,
from ./include/skidDriveLib.hpp:3,
from src/skidDriveLib.cpp:2:
c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\bits\stl_function.h:159:12: note: 'template<class _Tp> struct std::modulus' declared here
159 | struct modulus;
| ^~~~~~~
I have created a new project and included okapi/api.hpp and api.h and it compiled fine, so it has to be something with my project, whether we are accessing something incorrectly or it is set up wrong, I’m not sure. The file that it says has the error also is the same between the new project and our current one (I used a diff checker).
Has anyone else had this problem before? If so, were you able to fix it and how? Thanks.
I have had similar issues and fixed it by going into my project folder and running pros c apply okapilib --force-apply.
I think some of the files get messed up somehow causing it to stop working. This downloads
the latest release of OkapiLib and reapplies the OkapiLib template, pretty much resetting the files.
The error still persists after running that. I’ve compared the file that seems to be causing the error to the a new project that compiles fine and there are no differences (at least the header file, didnt look into the binary files or anything related to that).
Also, just to mention, I have done a make clean and that did not fix it.
PS C:\repo\25K-2023-spinup> pros build-compile-commands
Compiled src/autonomous15.cpp [WARNINGS]
cc1plus.exe: error: return type specified for deduction guide
In file included from ./include/okapi/api/util/logging.hpp:10,
from ./include/okapi/api/chassis/controller/chassisScales.hpp:11,
from ./include/okapi/api/chassis/controller/chassisController.hpp:8,
from ./include/okapi/api/chassis/controller/chassisControllerIntegrated.hpp:8,
from ./include/okapi/api.hpp:38,
from ./include/skidSteeringChassisSubsystem.hpp:2,
from ./include/skidDriveLib.hpp:6,
from src/autonomous15.cpp:2:
./include/okapi/api/util/mathUtil.hpp:210:11: error: ‘decl-specifier’ in declaration of deduction guide
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~
./include/okapi/api/util/mathUtil.hpp:210:1: error: ‘decl-specifier’ in declaration of deduction guide
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~~~~~~
./include/okapi/api/util/mathUtil.hpp:210:11: error: ‘long’ specified with ‘modulus<…auto…>’
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~
./include/okapi/api/util/mathUtil.hpp:210:16: error: deduction guide for ‘std::modulus<_Tp>’ must have trailing return type
210 | constexpr long modulus(const long lhs, const long rhs) noexcept {
| ^~~~~~~
In file included from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\string:48,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\bits\locale_classes.h:40,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\bits\ios_base.h:41,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\ios:42,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\ostream:38,
from c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\iostream:39,
from ./include/api.h:30,
from ./include/odometrySubsystem.hpp:2,
from ./include/skidDriveLib.hpp:3,
from src/autonomous15.cpp:2:
c:\program files\pros\toolchain\usr\arm-none-eabi\include\c++\10.2.1\bits\stl_function.h:159:12: note: ‘template struct std::modulus’ declared here
159 | struct modulus;
| ^~~~~~~
Compiled src/catapultSubsystem.cpp [WARNINGS]
intercept-c++.exe: Keyboard interrupt
make: *** Deleting file ‘bin/catapultSubsystem.cpp.o’
mv: cannot stat ‘.d/catapultSubsystem.Td’: No such file or directory
make: [common.mk:271: bin/catapultSubsystem.cpp.o] Error 1 (ignored)
The code compiles now after receiving help from the VRC Discord server. The problem can either be solved from reinstalling PROS and/or moving it out of OneDrive. I’m not sure which one it is as I had done both at the same time before compiling since I was unable to compile after reinstalling PROS.