Take a look at the link line and make sure that all of the appropriate libraries are being included at the end.
Take a look at the link line and make sure that all of the appropriate libraries are being included at the end. Common ones that you might have missed are '-ldl' and any libraries required for any database support you included.