gcc
gcc copied to clipboard
float functions not linked with -lm
Compile:
#include <iostream>
#include <cmath>
int main() {
// Sample floating-point number
float number = 3.75;
// Rounding the number using rintf
float roundedNumber = rintf(number);
// Displaying the result
std::cout << "Number before rounding: " << number << std::endl;
std::cout << "Rounded number: " << roundedNumber << std::endl;
return 0;
}
$m68k-amigaos-g++ -Os -m68020 -noixemul rintf.cpp -o rintf -lm Result:
/opt/amiga/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: /tmp/ccpSvFYp.o: in function `main':
/tmp/ccpSvFYp.o:(.text+0x40): undefined reference to `rintf'
Links only with manually providing /opt/amiga/m68k-amigaos/lib/libm020/libm.a
EDIT: Compiled binary is not executable.
add -l__m__