Linking against static library c++

Hi all C/C++ programmers out there!

I have a little problem here…
I’d like to build a static library, and a program using it. I’m not familiar with make (yet), so I’m intended to write my own build script.
I compile the static library sources:

g++ -I My/Headers -c *.cpp

and create the library:

ar -cvq libmy.a *.o

Everything is ok so far.
Now I’d like to compile the program:

g++ -I My/Headers -L My/Libs -lmy -static myprog.cpp -o myprog

But I get a linker error, It’s likely that g++ can’t find libmy.a or needed objects aren’t included in that.

Well, the paths and filenames are fictive, but there should be no problem there.

Thanks in advance.

Shouldn’t -I and -L params be without space? Like g++ -IMy/Headers -LMy/Libs -lmy -static myprog.cpp -o myprog