QP School
Linking external libraries in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Linking external libraries in C (/showthread.php?tid=5109)



Linking external libraries in C - Qomplainerz - 07-25-2023

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;
}