Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linking external libraries in C
#1
To use functions from external libraries, you need to link them during the compilation process.

// Compile with math library
// gcc main.c -lm -o main
#include <stdio.h>
#include <math.h>

int main() {
    double result = pow(2, 3);
    printf("2^3 = %.2f\n", result); // Output: 2^3 = 8.00
    return 0;
}
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)