Hi,
I am getting the following error while compiling
error: argument of type 'void(FClass::)()' does not match 'void(*)()'
on the line
fPointer=instance.PrintIt; // Give the pointer the function address
This is my code
/**
* @file FPointer.c
* This is the main FPointer program start point.
*/
/**
* Main program function.
*/
#include <stdio.h>
#include <propeller.h>
#include "FClass.c"
int main(void)
{
FClass instance; // Create an instance of the class
void (*fPointer)(); // This will point to a function in FClass
waitcnt(CLKFREQ*3+CNT); // Give the microcontroller 3 secs to boot
fPointer=instance.PrintIt; // Give the pointer the function address
return 0;
}
and
/**
* @file FClass.c
*/
#include <stdio.h>
class FClass
{
int number; // We will print this number
public:
FClass()
{
number=8; // Initialize the number
}
void PrintIt()
{
printf("%d",number); // Print the number
}
};
Thanks,
Enrique