Skip to main content
Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 
gcc test.c -o test 

It was tested on GCC 7.5.0 (on Ubuntu 16.04) and GCC 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

It was tested on GCC 7.5.0 (on Ubuntu 16.04) and GCC 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

It was tested on GCC 7.5.0 (on Ubuntu 16.04) and GCC 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Active reading [<https://en.wikipedia.org/wiki/GNU_Compiler_Collection>]. Added some context. Dressed the naked links.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

TestedIt was tested on gccGCC 7.5.0 (on Ubuntu 16.04Ubuntu 16.04) and gccGCC 4.8.0 (on CentOSCentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

Tested on gcc 7.5.0 (on Ubuntu 16.04) and gcc 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

It was tested on GCC 7.5.0 (on Ubuntu 16.04) and GCC 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

add more references
Source Link
jdhao
  • 29.5k
  • 23
  • 160
  • 323

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

Tested on gcc 7.5.0 (on Ubuntu 16.04) and gcc 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

Tested on gcc 7.5.0 (on Ubuntu 16.04) and gcc 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

Note that -lm may not always need to be specified even if you use some C math functions.

For example, the following simple program:

#include <stdio.h> #include <math.h> int main() { printf("output: %f\n", sqrt(2.0)); return 0; } 

can be compiled and run successfully with the following command:

gcc test.c -o test 

Tested on gcc 7.5.0 (on Ubuntu 16.04) and gcc 4.8.0 (on CentOS 7).

The post here gives some explanations:

The math functions you call are implemented by compiler built-in functions

See also:

Source Link
jdhao
  • 29.5k
  • 23
  • 160
  • 323
Loading