Closed GoogleCodeExporter closed 9 years ago
Make sure the *_test libraries are actually linked into the final binary.
The linker might be excluding them because you are not using any symbol from it
on you main file.
See
https://code.google.com/p/googletest/wiki/Primer#Important_note_for_Visual_C++_u
sers
That is for VC++, but it applies to gcc also. I think --whole-archive can be
used for gcc to force the library to be linked.
Original comment by sbe...@google.com
on 5 Dec 2014 at 7:33
You were right: The *_test libraries weren't linked to the final binary. It
wasn't a CMake specific error, GCC just won't link unreferenced libraries. The
--whole-archive flag doesn't work either - You have to use --no-as-needed.
Thanks for all your help. I'll probably introduce fake dependencies to make it
work in a cleaner way.
Shouldn't this information be added in the FAQ? Anybody upgrading to the newer
compiler should face this.
Original comment by rishin.g...@gmail.com
on 6 Dec 2014 at 7:27
Original comment by sbe...@google.com
on 8 Dec 2014 at 2:47
Original issue reported on code.google.com by
rishin.g...@gmail.com
on 5 Dec 2014 at 6:20