Article # 267, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
Function is prototyped, but compiler complains that it's not.
Q. I have a question about using functions in GOC. Whenever I make a function, the compiler ignores my prototype and generates a warning saying I'm calling a function without prototyping it. The code works, it just gives an annoying warning it shouldn't give when it compiles. This happens when my prototype is either in a .h file or the .goc file. But if I put my prototype in a .goh file, it gets ignored even more and causes errors when I try to use the function. It gives two messages, one a warning and the other an error. First it warns me I didn't prototype the function, then it errors out saying my parameters/return type don't match those of the prototype. That doesn't make sense. It saying I didn't prototype it, then saying I'm not using the prototype I declared. Am I doing something wrong? For example, I used some files from a C library I made. I took the .c and .h files and added them to the program. But when I compile the program, all my function calls from the .goc file complain I didn't prototype the function. But when it compiles the .c files, it doesn't complain about not prototyping. The prototypes are in a .h file that is included into both the .goc and .c files. A. You're probably doing something like this: void MyFunc(); This will fix it: void MyFunc( void ); Sorry, no cool explanation as to why this makes a difference. Just know that it does.