Ubuntu12.04下編譯gtest

1、從官網下載gtest 

2、使用unzip解壓文件(zip格式)
3、進入make文件夾,make。
4、如果編譯不通過,提示”undefined reference to 'pthread setspecific'”,修改make文件(Makefile)將-lpthread 放到最後。如下:
g++ -I../include -g -Wall -Wextra sample1.o sample1-unittest.o gtest_main.a -o sample1_unittest -lpthread.
5、編譯完成,生成執行文件sample1_unittest,執行文件,顯示測試結果。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章