I’m trying to use network tables in C++ on windows, using Visual Studio.
After building with gradle and including the proper directories, I get several errors.
Error 5 error C4996: 'ITable::GetNumber': Raises an exception if key not found; use GetNumber(StringRef key, double defaultValue) instead C:
tcore\include
etworktables\NetworkTable.h 477 1 GoalDetection
I get similar error for GetString and GetBoolean
All you have to do is use the same function with different parameters. Instead of:
table->GetNumber(“x”);
do this instead
table->GetNumber(“x”, 0.0);
This just sets a default value for that value in the table in case the robot is not connected to the driver station yet. If it didn’t it would throw an exception, like it says in the error.
The error I’m getting is in NetworkTable.h, I got the error as soon as included the file.