An error occurs when compiling a project with a dynamic library located in the lib folder. Help me figure out how to correctly specify the path. Thank.
lib / sum.c
#include "sum.h" int f1(int a, int b) { return a + b; }
lib / sum.h
int f1(int, int);
The main file main.c is in the root of the folder, it contains the path to the file sum.h. How to correctly.
main.c
#include <stdio.h> #include "./lib/sum.h" int main(void) { printf("%d", f1(10, 20)); getchar(); return 0; }
Creating a dynamic library is great. It appears in the lib package.
gcc -shared ./lib/sum.c -o ./lib/libsum.dll
But when compiling a project with a dynamic library from the lib folder, an error occurs.
gcc main.c -o abc.exe -L ./lib/libsum.dll
-L lib -lsum
course you tried? - 0andriy