mandliya / algorithms_and_data_structures使用Qt打開編譯報錯解決辦法

數據結構是程序員進及之路的關卡,Github上C++關注率最高的一份數據結構代碼如下,但是在用Qt打開的時候發現有些小的細節上的報錯,

Github:[https://github.com/mandliya/algorithms_and_data_structures]

1 CmakeList 增加pthread鏈接庫,有些程序編譯需要pthread依賴
        add_executable( ${demo_name} ${sourcefile} )
		if (${demo_name} STREQUAL "pstring_test")
                        target_link_libraries (${demo_name} pstring pUnitTest)
                endif()
                        target_link_libraries (${demo_name} pthread) #加上這句
2 reverse_word.cpp 添加頭文件,否則std::reverse找不到該函數
#include <algorithm>
3 word_pattern.cpp 添加頭文件,否則std::istream_iterator找不到該函數
#include <iterator>
4 最後一個是警告,即有符號整數與無符號整數進行了比較,更改如下:把int改爲size_t
    for (size_t i = 0; i < pattern.size(); ++i)

最後開啓你的data structure之路吧
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章