From: http://www.lampos.net/taxonomy/term/72
You are a beginner in C programming language (maybe 1st year student
In a computer science department) and you want to meet a deadline for
Programming assignment. The program specification is simple (because it
Is still the beginning) but there is something annoying happenning
Your source code.
The course extends uctor has forced you to compile your C Programs with all the appropriate flags enabled, e.g.
>> gcc program_name.c -ansi -pedantic -Wall -o program_name
Your program functions des mathematical functions and as a result you have included math. h Library
And you have added-LM
Flag during compilation time:
>> gcc program_name.c -ansi -pedantic -Wall -lm -o program_name
Your final program shold work
(Perfectly !) And after compilation no warnings shoshould appear.
Otherwise, you lose points on your final mark!
You have followed all the instructions, your program is working (!) But you still get an annoying warning, like:
implicit declaration of function abs
You try again and again, you 'Google 'This
Warning but there is no result. Usually, the compiler is absolutely
Right and points to the right ction (in simple programs of course ).
So, there is an implicit declation of the 'abs 'function (which returns
The absolute value of a number). Something is missing. What? The
Following line (in most of the cases ):
#include <stdlib.h>
You shoshould include stdlib. h Library
As well. Don't forget that! That's it... It shoshould have helped you! -:)