Showing posts with label linux questions. Show all posts
Showing posts with label linux questions. Show all posts
Tuesday, July 20, 2010
warning: return type of �main� is not �int�
When we will compile a c program we may get following error message:
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
When we will compile a c program in Linux GCC compiler we may get error message:
undefined reference to `sqrt' collect2: ld returned 1 exit status
Cause of this error is by default math.h library has not included.
Solution:
Compile the c code in the following way:
[root@localhost ~]# gcc abc.c -lm
Note: Here abc.c is name of any c code file.
undefined reference to `sqrt' collect2: ld returned 1 exit status
Cause of this error is by default math.h library has not included.
Solution:
Compile the c code in the following way:
[root@localhost ~]# gcc abc.c -lm
Note: Here abc.c is name of any c code file.
undefined reference to `pow' collect2: ld returned 1 exit status
In Linux GCC compiler when we compile a c program may get error message:
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.
Subscribe to:
Posts (Atom)