Hi, чт, 14 апр. 2022 г. в 10:33, Sad Clouds <cryintotheblue...@gmail.com>: > Create libtest.so shared library: > gcc -O2 -fPIC -DPIC -c libtest.c && \ > gcc -O2 -fPIC -DPIC -shared -Wl,--default-symver -Wl,-soname,libtest.so. > 1 -o libtest.so.1.0 libtest.o && \ ln -sf libtest.so.1.0 libtest.so > > Create main executable, linking it with libtest.so: > gcc -O2 -c main.c && \ > gcc -O2 -L./ -ltest -o main main.c
If you change the order and put dependencies after the dependents, linking works: gcc -O2 -o main main.o -L./ -ltest -- With best wishes Dmitry