Saturday, May 22, 2010

Why we get "declaration syntax error in c" & what is gcc compiler?

declaration syntax error: Number of causes but is basically an error where or how you are declaring a function , variable or anything else which must be declared. Your basic spelling and form of what you typed is reconizable by the compilier the problem is where this section of code is located





The error is usally indicated just after the ocurrance of the offending code which may give you a clue.





For example C requires a main function to be declared first which will contain your program





void main ()


{


'your C program goes here


int myFunction(int)


{


code foo


}


}





This would compile as main is declared in its proper location


how ever





int myFunction(int)


{


code foo


}


Void main()


{


other code





}





This code would most likely cause a declaration syntax error to happen just after the line containing [int myFunction(int)]





GCC: Is an open source C compilier. My limited experience with it comes from evaluating a GCC compilier for an AVR 8 bit micro processor. GNU is an open source operating system (think Linux). The GCC I tried was ported over to windows.





GCC = GNU C Compilier


GNU = Gnu (as in the animal name) is Not UNIX


No comments:

Post a Comment