Skip to content

Error compiling for board Arduino Leonardo: a function-definition is not allowed here before '{' token #170

Closed
@akakikuumeri

Description

@akakikuumeri

Compiling the velocity_control.ino example and all other sketches I have tried, using v. 2.2.1, targeting Arduino Leonardo in Arduino IDE on Windows exit with the following errors:

C:\Users\*****\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\atmega32u4_mcu.cpp: In function 'int _configure6PWM(long int, float, int, int, int, int, int, int)':
C:\Users\*****\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\atmega32u4_mcu.cpp:151:1: error: a function-definition is not allowed here before '{' token
 {
 ^
C:\Users\*****\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\atmega32u4_mcu.cpp:166:151: error: a function-definition is not allowed here before '{' token
 void _writeDutyCycle6PWM(float dc_a,  float dc_b, float dc_c, float dead_zone, int pinA_h, int pinA_l, int pinB_h, int pinB_l, int pinC_h, int pinC_l){
                                                                                                                                                       ^
C:\Users\***\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\atmega32u4_mcu.cpp:170:1: error: expected '}' at end of input
 }
 ^
exit status 1
Error compiling for board Arduino Leonardo.

Further, I also get multiple warnings like

C:\Users\*****\Documents\Arduino\libraries\Simple_FOC\src/communication/Commander.h:210:68: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     void target(FOCMotor* motor, char* user_cmd, char* separator = " ");

on both Leonardo but also on Arduino MEGA, but there they don't prevent me from compiling, so I am not sure if they are related to the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions