windows下编译Hugin时的template错误

Hugin依赖于VIGRA,而VIGRA包含大量的模板,编译Hugin是出现如下的大量错误:

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

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

这种模板类的错误信息很不明确,导致定位错误来源十分困难。

没办法,逐个cpp文件单独编译,逐一排查,发现是huginbase工程中的Exiv2Helper.cpp编译出错。

然后逐句注释、编译,最后发现是包含头文件的顺序导致的。即把:

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

改为:
#include "hugin_math/hugin_math.h"
#include "Exiv2Helper.h"

就好了。

posted on 2016-09-09 16:05  龖龖  阅读(315)  评论(0编辑  收藏  举报

导航