undefined reference while linking with a shared object

view story

http://stackoverflow.com – I'm a dumb newbie. I've got a file named file.c with the functions my_putstr(char *) and my_strlen(char *) my_putstr() writes the parameter with write() (unistd.h) I wanted to create a library from file.c so I did : gcc -fPIC -c file.c gcc -shared -o libfile.so file.o Then I created a main.c file and called my_putstr() from it. I tried to compile and link my .so gcc -L. -lfile main.c -o test But I got an undefined reference to my_putstr() I tried to create a .h with my_putstr() and my_strlen() in it, and include it to the main but I got the same error. Sorry for stupid questions. H (HowTos)