編譯Licode報錯:ifndef header guard has wrong style

編譯licode git上的master的時候,一切都很順利,但下載release中的壓縮包,解壓並編譯,當編譯到erizoAPI的時候卻報了很多相同的錯誤,都是說頭文件的風格不對,錯誤如下:

MediaStream.h:2:  #ifndef header guard has wrong style, please use: _HOME_TOPSLUO_WORKSPACE_TEST_LICODE_PRE_V7_14_ERIZOAPI_MEDIASTREAM_H_  [build/header_guard]

後來通過查找編譯腳本發現,在cpplint.py中找到一個參數:

--root=subdir
  The root directory used for deriving header guard CPP variable.
   By default, the header guard CPP variable is calculated as the relative path
    to teh directory that contains .git, .hg, or .svn, When this flag is specified, the relative 
    path is calculated from the specified directory. If the specified directory does not exist, 
    this flag is ignored.
    Examples:
    No flag => CHROME_BROWSER_UI_BROWSER_H_
    --root=chrome => BROWSER_UI_BROWSER_H_
    --root=chrome/browser => UI_BROWSER_H_

也就是說,如果當前目錄下存在.git或者.svn等目錄,root參數是會計算出來參數,否則–root參會被忽略掉,那就會出現開頭說的錯誤。

問題正是如此,因爲從master中clone下來的源碼存在.git目錄,而解壓壓縮包的源碼中不存在.git目錄,所以在調用cpplint.py的時候,可以指定–root參數來解決此問題,比如:

./cpplint.py --filter=-legal.copyright,-build/include --root=/home/topsluo/licode --linelength=120 *.cc *.h
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章