This is odd, compiling and linking with a single command works without -lm, but a two step compilation requires -lm. :shrug:
I request to fix this. I have linked 'm' in my compiler settings> linker settings. But I had to waste an amount of time to figure that out.
And another thing; I am using manjaro gnome and inside it, codeblocks. When I tried to run the first code in this new operating system; it was compiled and no error but the program was not running.
Then I wasted some time to figure it out that -- "xterm" was set as the default terminal emulator and wasn't installed in the system. Then I changed my default terminal emulator and also installed "xterm" for other users.
Codeblocks can't select the available terminal emulator? or install xterm as a dependency?
This two things. I wanted to inform you to make codeblocks better.