4
我一直在试图用静态库Gtest(gtest_main.a
)框架构建我的C项目。我已经包括在有关库文件和相应的路径IDE信息链接部分,但我仍然得到以下错误:在eclipse中链接静态库
******** Build of configuration Debug for project CPP_GTEST **** **** Internal Builder is used for build **** g++ -LC:/UT_automation_tools/CPP_GTEST/lib -o CPP_GTEST.exe ut_src\ut_asd.o mock_lib\sgn\sgn_asd.o asd\asd.o -lgtest_main c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lgtest_main collect2: ld returned 1 exit status Build error occurred, build is stopped Time consumed: 750 ms.****
我已经把链接器命令行patterb,因为它是默认其存在于eclipse ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
我一直在用谷歌搜索来解决这个问题,并且我尝试了各种方法,我通过google搜索时却没能解决问题。
[看到我的帖子] [1]。我今天解决了它。 [1]:http://stackoverflow.com/questions/11636755/eclipse-cdt-how-to-link-with-static-library/11644899#11644899 – 2012-07-25 13:09:28
是的,我按照如在建议该链接通过向工作空间添加静态库并在适当的位置提供静态库路径和名称(不带扩展名.a),但仍会出现相同的错误。任何提示?谢谢 !! – Thiru 2012-07-25 13:39:58
将其放入您的项目中。确保你没有lib作为前缀 – 2012-07-25 13:46:39