I was wondering if it is in any way possible to use a user defined class method in place of a function when creating a task (using vex’s built - in task class). I have tried already and got an error message, here is the code and error message:
#include "vex.h"
using namespace vex;
class PID
{ public:
PID ()
{
}
void Do_somthing ()
{
}
};
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
PID my_pid = PID();
task my_task = task(my_pid.Do_somthing);
}
The error message I get (not during compiling) occurs on the line where I declare the task
task my_task = task(my_pid.Do_something) ;
This is the error message:
[clang] No matching conversion for functional-style cast from ‘void’ to ‘vex::task’
- vex_task.h(32, 9): Candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type ‘void’ to ‘const vex::task’ for 1st argument
- vex_task.h(54, 7): Candidate constructor not viable: cannot convert argument of incomplete type ‘void’ to ‘int (*)()’ for 1st argument
- vex_task.h(46, 7): Candidate constructor not viable: requires 0 arguments, but 1 was provided
- vex_task.h(63, 7): Candidate constructor not viable: requires 2 arguments, but 1 was provided
- vex_task.h(73, 7): Candidate constructor not viable: requires 2 arguments, but 1 was provided
- vex_task.h(83, 7): Candidate constructor not viable: requires 3 arguments, but 1 was provided
[clang] Reference to non-static member function must be called; did you mean to call it with no arguments? (fix available)