On Mon, Dec 17, 2018 at 1:06 PM Marc Glisse <marc.glisse@xxxxxxxx> wrote: > > On Mon, 17 Dec 2018, Yubin Ruan wrote: > > > I am seeking help here since I got error of "undefined reference to > > fstat64/stat64" when linking without libstdc++ in a C++ program. I was > > trying to use libcxx, so I added -nodefaultlibs when compiling the > > program. To get necessary symbols from libc, I added -lc (and also > > -lm -lgcc_s -lgcc). But I still got the undefined reference error. > > > > Note that I never use fstat64/stat64 in my program. I only use fstat/stat. > > > > From the man page[1] it is said that on Linux fstat/stat is a wrapper > > around fstat64/stat64. So these two symbols must locate at some object > > file I don't know. > > Could it be that you are using those -l* flags in the wrong order? I don't think so. They are all added at the very end. Or, are you sure that fstat64/stat64 are located in libc.so ? Using "nm -gC /usr/lib64/libc.so |grep fstat64" give no output. -- Yubin