eclipse错误的解决(collect2: 错误:ld 返回 1)

一、eclipse报错:

08:40:28 **** Incremental Build of configuration Debug for project codetest ****
make all 
Building target: codetest
Invoking: GCC C Linker
gcc  -o "codetest"  ./src/nmeac/context.o ./src/nmeac/generate.o ./src/nmeac/generator.o ./src/nmeac/gmath.o ./src/nmeac/info.o ./src/nmeac/parse.o ./src/nmeac/parser.o ./src/nmeac/sentence.o ./src/nmeac/sum.o ./src/nmeac/time.o ./src/nmeac/tok.o ./src/nmeac/util.o  ./src/codetest.o   
./src/nmeac/generate.o:在函数‘nmea_gsv_npack’中:
/home/ppp/work/codetest/Debug/../src/nmeac/generate.c:119:对‘ceil’未定义的引用
./src/nmeac/gmath.o:在函数‘nmea_calc_pdop’中:
/home/ppp/work/codetest/Debug/../src/nmeac/gmath.c:78:对‘pow’未定义的引用
.
.
.
/home/ppp/work/codetest/Debug/../src/nmeac/gmath.c:340:对‘atan2’未定义的引用
/home/ppp/work/codetest/Debug/../src/nmeac/gmath.c:356:对‘atan2’未定义的引用
collect2: 错误:ld 返回 1
make: *** [codetest] Error 1
makefile:31: recipe for target 'codetest' failed
"make all" terminated with exit code 2. Build might be incomplete.

08:40:28 Build Failed. 2 errors, 0 warnings. (took 398ms)

二、分析
刚开始只注意到makefile的错误@echo 'Building target: $@',各种查makefile资料,无果。
后对代码做减法,去掉不必要的c文件,后来发现能编译过。才意识到是上面报“对xxxx未定义的引用”的问题 ,错误很简单,用到数学函数不能只包含,还要“-lm”。

eclipse错误的解决(collect2: 错误:ld 返回 1)_第1张图片

你可能感兴趣的:(eclipse)