opencl linking error

My single opencl c program file is getting large and I am trying to split it into smaller files. I can successfully compile and even link some of them into library individually using "-create-library" option. But when trying to link the compiled programs according to opencl 1.2 specifications on clLinkProgram I always get error code -17, which simply means failed to link, no further information can be obtained. This happens whenever  the number of programs to be linked is greater than 1.

 

Would anybody please tell me what I am missing?

 

Thanks!