[英]Static library linking in eclipse
我一直在尝试使用静态库Gtest( gtest_main.a
)框架来构建C项目。 我已在IDE的链接器部分中包含有关库文件和相应路径的信息,但仍然出现以下错误:
******** 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.****
我保留了链接器命令行模式,因为它是默认的,出现在Eclipse ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
我一直在使用Google搜索来解决问题,并且尝试了各种在搜索时遇到的方法,但无法解决问题。
您已经发现,链接器参数-lName
使链接器在库路径中搜索libName.a
有关更多信息,请参见系统上ld的手册页-我的指定:
-l namespec
--library=namespec
Add the archive or object file specified by namespec to the list of files to link. This option
may be used any number of times. If namespec is of the form :filename, ld will search the
library path for a file called filename, otherwise it will search the library path for a file
called libnamespec.a.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.