You may find that you need to associate with the math libraries any system you use, for example:
gcc -o myprog myprog.c -L/path/to/libs -lm ^^^ - this bit here.
Enabling headers allows the compiler to learn about function declarations, but does not necessarily automatically refer to the code needed to execute that function.
Otherwise, you will need to show us your code, the compilation team and the platform on which you work (operating system, compiler, etc.).
The following code compiles and contains links:
#include <math.h> int main (void) { int max = sqrt (9); return 0; }
Just remember that some compilation systems depend on the order in which libraries are listed on the command line. By this, I mean that they can process libraries sequentially and use them only to satisfy unresolved characters at this point in the sequence.
So, for example, taking into account the commands:
gcc -o plugh plugh.o -lxyzzy gcc -o plugh -lxyzzy plugh.o
and plugh.o requires something from the plugh.o library, the second may not work as you expect. The moment you list the library, there are no satisfactory unresolved characters.
And when unresolved characters from plugh.o , it's too late.
paxdiablo Mar 09 2018-11-11T00: 00Z
source share