我正在尝试C++
使用以下编译命令编译 Hadoop wordCout 示例()
g++ -o a -L/home/pc/run/hadoop-install/hadoop/lib/native -lhadooppipes -lhadooputils -lpthread -I/home/pc/run/hadoop-install/hadoop/include wordCount.cpp -Wall
Hadoop 版本是 0.23.5。
操作系统是 Ubuntu 12.04
但是,我收到如下链接错误:
g++ -o a -L/home/pc/run/hadoop-install/hadoop/lib/native -lhadooppipes -lhadooputils -lpthread -I/home/pc/run/hadoop-install/hadoop\
/include wordCount.cpp -Wall
6/tmp/cc3Cte9z.o: In function `main':
7wordCount.cpp:(.text+0x26): undefined reference to `HadoopPipes::runTask(HadoopPipes::Factory const&)'
8/tmp/cc3Cte9z.o: In function `WordCountMap::map(HadoopPipes::MapContext&)':
9wordCount.cpp:(.text._ZN12WordCountMap3mapERN11HadoopPipes10MapContextE[WordCountMap::map(HadoopPipes::MapContext&)]+0x2e): undefin\
ed reference to `HadoopUtils::splitString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const\
*)'
10/tmp/cc3Cte9z.o: In function `WordCountReduce::reduce(HadoopPipes::ReduceContext&)':
11wordCount.cpp:(.text._ZN15WordCountReduce6reduceERN11HadoopPipes13ReduceContextE[WordCountReduce::reduce(HadoopPipes::ReduceContext\
&)]+0x26): undefined reference to `HadoopUtils::toInt(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&\
)'
12wordCount.cpp:(.text._ZN15WordCountReduce6reduceERN11HadoopPipes13ReduceContextE[WordCountReduce::reduce(HadoopPipes::ReduceContext\
&)]+0x5b): undefined reference to `HadoopUtils::toString(int)'
13collect2: ld returned 1 exit status
14make: *** [a] Error 1
有谁知道哪里出了问题?