You appear to have attempted to make symbolic links to libgtest.a
and libgmock.a
by using the commands:
sudo ln -s lib/.libs/libgtest.a /usr/lib/libgtest.a
sudo ln -s lib/.libs/libgmock.a /usr/lib/libgmock.a
from the console in /your/path/to/gtest-1.7.0
and /your/path/to/gmock-1.7.0
respectively.
If you open /usr/lib
in your file manager, find the links libgtest.a
and libgmock.a
and exam their properties, I believe you will find that
these links are broken, and that is why the linker cannot find them
in your project. Your ln
commands give relative paths to their targets,
but absolute paths are needed.
If so, delete the broken links and recreate them with the commands:
sudo ln -s /full/path/to/gtest-1.7.0/lib/.libs/libgtest.a /usr/lib/libgtest.a
sudo ln -s /full/path/to/mock-1.7.0/lib/.libs/libgmock.a /usr/lib/libgmock.a
E.g on my system /full/path/to/
= /home/imk/develop/
Then I think your build will work.
However, creating these symbolic links in /usr/lib
slightly taints your
system installation. It would be better to create them in /usr/local/lib
.
Or even simpler, you can just add these static libraries to the object files
for your project linkage:
In Eclipse, navigate your project -> Properties -> C/C++ build -> Settings -> your compiler Linker -> Libraries and delete
gmock.a
,gtest.a
Immediately under Libraries you find Miscellaneous. There, in Other objects, add:
/full/path/to/libgtest.a
/full/path/to/libgmock.a
All these suggestions have worked for me.