Pheonix MapReduce - Wordcount 错误及解决方法

来源:互联网 发布:料理机 鱼汤 知乎 编辑:程序博客网 时间:2024/05/21 01:43

系统:KUbuntu11.04

调试错误

g++ -g -Wall -O3 -D_LINUX_  -DMMAP_POPULATE -fstrict-aliasing -Wstrict-aliasing  -D__x86_64__ -c word_count.cpp -o word_count.o -I../../includeIn file included from ../../include/map_reduce.h:37:0,                 from word_count.cpp:39:../../include/stddefines.h: 在函数‘void get_time(timespec&)’中:../../include/stddefines.h:86:19: 警告: variable ‘noskip’ set but not used [-Wunused-but-set-variable]In file included from word_count.cpp:39:0:../../include/map_reduce.h: 在成员函数‘int MapReduce<Impl, D, K, V, Container>::run(std::vector<MapReduce<Impl, D, K, V, Container>::keyval>&) [with Impl = WordsMR, D = wc_string, K = wc_word, V = long unsigned int, Container = hash_container<wc_word, long unsigned int, sum_combiner, wc_word_hash>]’中:word_count.cpp:223:5:从此处实例化../../include/map_reduce.h:202:5: 错误: 将‘const WordsMR’作为‘int WordsMR::split(wc_string&)’的‘this’实参时丢弃了类型限定 [-fpermissive]make: *** [word_count.o] 错误 1

解决方法:

修改Makefile文件,将 -fpermissive 加进去,修改后如下:

-------------------------------------------

HOME = ../..include $(HOME)/Defines.mkLIBS += -L$(HOME)/$(LIB_DIR) -l$(PHOENIX)WC_OBJS := word_count.oPROGS := word_count.PHONY: default all cleandefault: allall: $(PROGS)word_count: $(WC_OBJS) $(LIB_DEP)$(CXX) -fpermissive $(CFLAGS) -o $@ $(WC_OBJS) $(LIBS)%.o: %.cpp$(CXX) -fpermissive $(CFLAGS) -c {1}lt; -o $@ -I$(HOME)/$(INC_DIR)clean:rm -f $(PROGS) $(WC_OBJS)

注意$CXX, rm开头必须要有"Tab"间隔符,不能有空格,否则调试出错!


原创粉丝点击