Tutorial :warning: declaration does not declare anything



Question:

I'm getting this warning all over the place in some perfectly well functioning objective-c code within XCode. My google-fu has failed me... others have run into this but I could not find an explanation on what exactly is causing it or how it can be fixed.


Solution:1

In pure C, the following code:

int;  typedef int;  

elicits the following warnings from GCC with no warning options set:

x.c:1: warning: useless keyword or type name in empty declaration  x.c:1: warning: empty declaration  x.c:2: warning: useless keyword or type name in empty declaration  x.c:2: warning: empty declaration  

Maybe you have something analogous in your code?


Solution:2

Found the problem and fixed it. I had this:

enum eventType { singleTouch };  enum eventType type;  

... and changed it to:

enum eventType { singleTouch } type;  


Solution:3

I was able to replicate this error with the following code:

#define MY_INT int;  MY_INT a;  

It compiles removing the ';' in the #define line.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »