编译NMEA Library0.5.3报错:
mkdir -p build/nmea_gcc
gcc -I include -c src/generate.c -o build/nmea_gcc/generate.o
gcc -I include -c src/generator.c -o build/nmea_gcc/generator.o
gcc -I include -c src/parse.c -o build/nmea_gcc/parse.o
gcc -I include -c src/parser.c -o build/nmea_gcc/parser.o
gcc -I include -c src/tok.c -o build/nmea_gcc/tok.o
gcc -I include -c src/context.c -o build/nmea_gcc/context.o
gcc -I include -c src/time.c -o build/nmea_gcc/time.o
gcc -I include -c src/info.c -o build/nmea_gcc/info.o
gcc -I include -c src/gmath.c -o build/nmea_gcc/gmath.o
gcc -I include -c src/sentence.c -o build/nmea_gcc/sentence.o
ar rsc lib/libnmea.a build/nmea_gcc/generate.o build/nmea_gcc/generator.o build/nmea_gcc/parse.o build/nmea_gcc/parser.o build/nmea_gcc/tok.o build/nmea_gcc/context.o build/nmea_gcc/time.o build/nmea_gcc/info.o build/nmea_gcc/gmath.o build/nmea_gcc/sentence.o
ranlib lib/libnmea.a
gcc -I include -c samples/generate/main.c -o samples/generate/main.o
gcc samples/generate/main.o -lm -Llib -lnmea -o build/samples_generate
lib/libnmea.a(generate.o):在函数‘nmea_gsv_npack’中:
generate.c:(.text+0x7f0):对‘ceil’未定义的引用
collect2: error: ld returned 1 exit status
make: * [samples_generate] 错误 1
rm samples/generate/main.o
编辑MakeFile,在gcc 编译c文件末加上-ml
即:
samples_%: samples/%/main.o
(CC) ( C C ) < (LIBS)−obuild/ ( L I B S ) − o b u i l d / @ -lm