c++ - Google test with Eclipse on Windows -


i trying setup google test eclipse. have done far:

initial setup:

  1. installed cdt on eclipse helios.
  2. downloaded , installed cygwin.
  3. downloaded , extracted gtest.
  4. built gtest using cygwin make using default makefile.

in eclipse:

  1. created empty executable c++ project cygwin in toolchain.
  2. added "[gtest_dir]\include" in c++ build/settings/cygwin c++ compiler
  3. added library path "[gtest_dir]\make" under c++ build/settings/cygwin c++ linker
  4. builder gnu make builder
  5. wrote example c++ code , built project.

i facing following error when build project:

building target: samplecpp.exe invoking: cygwin c++ linker g++ -l/cygdrive/d/gtest-1.7.0/make -o"samplecpp.exe" ./src/counter.o ./src/counter_tests.o -lgtest /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld: cannot find -lgtest collect2: error: ld returned 1 exit status makefile:45: recipe target 'samplecpp.exe' failed

what missing?

edit 1 : [gtest_dir]\make contains 2 .a files - gtest.a , gtest_main.a

also i'm using eclipse helios

edit 2 :

it worked after renamed gtest.a gtest.lib. expected naming format library on windows?

in project properties configuration, under c/c++ build > settings > tool settings > cygwin c++ linker > miscellaneous > other objects, add $gtest_dir/make/gtest_main.a.

this makes linker see gtest_main.a archive of object files, rather library.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -