Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux64 build: error: atoi was not find in this scope #298

Open
cyphunk opened this issue Jun 18, 2020 · 1 comment
Open

Linux64 build: error: atoi was not find in this scope #298

cyphunk opened this issue Jun 18, 2020 · 1 comment

Comments

@cyphunk
Copy link

cyphunk commented Jun 18, 2020

  • I'm using DynamixelSDK git, ver. 3.7.21 or greater
  • I'm using C++ Language
  • I'm using USB2Dynamixel2 serial converter
  • I'm using XM430-W250-T
  • and I'm having an issue like what

Error on compile of dynamixel-workbench/dynamixel_workbench_toolbox/examples/

[ 16%] Building CXX object CMakeFiles/find_dynamixel.dir/src/o_Find_Dynamixel.cpp.o
[ 18%] Linking CXX executable find_dynamixel
[ 18%] Built target find_dynamixel
Scanning dependencies of target sync_read_write
[ 21%] Building CXX object CMakeFiles/sync_read_write.dir/src/m_Sync_Read_Write.cpp.o
/motors/dynamixel/U2D2_SMPS_XL430/dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/m_Sync_Read_Write.cpp: In function ‘int main(int, char**)’:
/motors/dynamixel/U2D2_SMPS_XL430/dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/m_Sync_Read_Write.cpp:39:17: error: ‘atoi’ was not declared in this scope
39 |     baud_rate = atoi(argv[2]);
|                 ^~~~
/motors/dynamixel/U2D2_SMPS_XL430/dynamixel-workbench/dynamixel_workbench_toolbox/examples/src/m_Sync_Read_Write.cpp:134:12: error: ‘abs’ was not declared in this scope
134 |     }while(abs(goal_position[0] - present_position[0]) > 15 &&
|            ^~~
make[2]: *** [CMakeFiles/sync_read_write.dir/build.make:83: CMakeFiles/sync_read_write.dir/src/m_Sync_Read_Write.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:155: CMakeFiles/sync_read_write.dir/all] Error 2
make: *** [Makefile:104: all] Error 2

This is on archlinux, cmake version 3.17.3, gcc (GCC) 10.1.0

@cyphunk
Copy link
Author

cyphunk commented Jun 18, 2020

I was able to resolve this by adding the following to all source files:

#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;

I doubt this is the smartest solution but in-case someone runs into the same issue, this should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant