Showing posts with label Function tutorial in c. Show all posts
Showing posts with label Function tutorial in c. Show all posts

Tuesday, 20 July 2010

warning: return type of ‘main’ is not ‘int’

Solution:Cause of this warning message is return type of main function is not int. It is necessary to  return an int value by main function. If main function returns 0 then operating system treat it as success.For example:int main(){   //Write your c code.}

undefined reference to `sqrt' collect2: ld returned 1 exit status

Solution:Cause of this error is by default math.h library has not included. So compile the c code in the following way:[root@localhost ~]# gcc abc.c -lmNote: Here abc.c is name of any c code file.

undefined reference to `pow' collect2: ld returned 1 exit status


Error message: undefined
reference to `pow' collect2: ld returned 1 exit status

Compiler:
Linux gcc



Solution:



Cause of this error is
by default math.h library has not included. So compile the c code in following
way:



[root@localhost ~]# gcc
abc.c -lm



Note: Here abc.c is name
of any c code file.

Saturday, 13 March 2010