c++ - Google test with Eclipse on Windows -
i trying setup google test eclipse. have done far:
initial setup:
- installed cdt on eclipse helios.
- downloaded , installed cygwin.
- downloaded , extracted gtest.
- built gtest using cygwin make using default makefile.
in eclipse:
- created empty executable c++ project cygwin in toolchain.
- added "[gtest_dir]\include" in c++ build/settings/cygwin c++ compiler
- added library path "[gtest_dir]\make" under c++ build/settings/cygwin c++ linker
- builder gnu make builder
- 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
Post a Comment