On Thu, Jan 10, 2013 at 10:06 AM, horseriver <horserivers@xxxxxxxxx> wrote: > > I should not blame gcc's optimization , but here it has caused an error : > when linking , ld will look for this strcpy's implemention and fill into this .o > file with strcpy's address . In my project , strcpy is implemented in source code. > so I linked this .o file with that .o which has implemented strcpy , but ld reported this to me : > > undefined reference to `strcpy' at this .o file > > I could not understand this . Is there some advice ? Use "readelf -s" or "nm" to verify that you really have a function named strcpy in the .o file you expect it to be in. When linking, use -Wl,-y,strcpy to trace when the linker sees the strcpy symbol. Ian