What is your complete gcc / linker command line? are you sure you are listing the libraries in the required order?