windows下編譯Hugin時的template錯誤

Hugin依賴於VIGRA,而VIGRA包含大量的模板,編譯Hugin是出現以下的大量錯誤:app

"unexpected token(s) preceding ':'; skipping apparent function body"spa

"'vigra::NumericTraits<unsigned char>': cannot specialize template in current scope"token

這種模板類的錯誤信息很不明確,致使定位錯誤來源十分困難。ip

沒辦法,逐個cpp文件單獨編譯,逐一排查,發現是huginbase工程中的Exiv2Helper.cpp編譯出錯。ci

而後逐句註釋、編譯,最後發現是包含頭文件的順序致使的。即把:it

#include "Exiv2Helper.h"
#include "hugin_math/hugin_math.h"io

改成:
#include "hugin_math/hugin_math.h"
#include "Exiv2Helper.h"編譯

就行了。function

相關文章
相關標籤/搜索