[ăsta e ultimu post pe această temă - promit!
]
Ceva nu este în regulă ...
Dacă ce scrie aci e corect:
The problem is that the reference to the sqrt function cannot be resolved without the external math library 'libm.a'. The function sqrt is not defined in the program or the default library 'libc.a', and the compiler does not link to the file 'libm.a' unless it is explicitly selected. [...]
To enable the compiler to link the sqrt function to the main program 'calc.c' we need to supply the library 'libm.a'. One obvious but cumbersome way to do this is to specify it explicitly on the command line:
$ gcc -Wall calc.c /usr/lib/libm.a -o calc
The library 'libm.a' contains object files for all the mathematical functions, such as sin, cos, exp, log and sqrt. [...]
To avoid the need to specify long paths on the command line, the compiler provides a short-cut option '-l' for linking against libraries. For example, the following command,
$ gcc -Wall calc.c -lm -o calc
is equivalent to the original command above using the full library name '/usr/lib/libm.a'.
Textul complet e la
www.network-theory.co.uk/...şi dacă ce zici tu e tot corect:
gcc -lm -Wall --static -o <sursa> <sursa>.<extensie>
atunci opţiunea "-lm" ar trebui să aibă ca efect tocmai legarea bibliotecii matematice şi deci oferirea posibilităţii de a folosi orice funcţie matematică -
inclusiv sqrt.
La ONI , teoretic vorbind, ai acces la compilator şi poţi să incluzi manual opţiunea respectivă dacă nu este.
luuung post, ştiu, da' asta e ...
Numai bine,
Eugen Neamţiu.