Question

I am running a simple gtest sample in eclipse CDT using cygwin, initially i was getting error as

make***multiple target pattern

Then I changed the library path from D:/ to /cygdrive/d/ and the error is gone but now it is telling

undefined reference to blah blah files
collect2: ld returned 1 exit status
make: *** [sample_gmock.exe] Error 1

I checked the makefile and objects.mk all the things are proper there

g++ -L"/cygdrive/D/Project/gmock-1.6.0/gtest/make" -o "sample_gmock.exe"
./src/sample1.o ./src/sample1_unittest.o  /cygdrive/D/Project/gmock-1.6.0/gtest
/make/gtest_main.a -lpthread

What should I do to resolve and make it work, so that I am able to run gmock and gtest in eclipse using cygwin

Was it helpful?

Solution

At first I was working on Linux environment and had gmock_main.a and gtest_main.a generated over there. Same files I was using in Windows environment in Eclipse, so it was giving error.

To get rid of the error I compiled the gmock and gtest code in cygwin terminal to generate gmock_main.a and gtest_main.a, and its working fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top