I am trying to pass a pointer by reference to a function and get that function to point my pointer at a structure that it finds.
char get_structure(STRUCTURE **ptr) { if(foundstructure) { *ptr = &theStructure; return 1; } return 0; }
This works how I expect it, but when I try and declare the function prototype in the header file:
char get_structure(STRUCTURE **ptr);
I always get a compiler error:
error C141: syntax error near '*', expected ')'
I don't get an error when this is a defined type like char, int or long, but I get the error when this is a pointer to a typedef that I have defined.
How can I declare this in my header file without an error?
Nathan
I know it's not the structure that is the problem. This structure has been used in it's current state for over a year now in many implementations. It is only the double pointer in the prototype that is causing grief.
Actually, no, it's not. If you put that exact code into (minus the syntax error '...', and plus a typedef for uint8) into an empty file, and compile that, it works just fine and dandy (uV4, C51 9.02). Which goes to show that whatever the problem actually is, it's not what you claim it is.
So, next try: show an actual, self-contained example that demonstrates the error.
I seem to be dealing with an include/linker error. The structure is not defined at that point in the header file. I was sure I tested this by declaring the parameter by value and by reference, and the error would only show up by pointer reference (double pointer). Since yesterday I updated to 9.05 an now all 3 are returning the C141 error. The forward declaration as someone mentioned doesn't work though... will post again when I've solved this.