编译出错 ------ undefined reference to `ceilf'
to 编译 39 出错 ------ reference undefined
2023-09-11 14:19:53 时间
ceilf是一个在math.h里面的一个数学函数,函数的实现位于 libm.a 库文件中,使用 math.h 中声明的库函数时,gcc命令行必须加-lm选项
这时我们就需要在编译的时候加上-lm参数,即
gcc test.c -o test -lm
如果是用的makefile,就要在相应的文件里面加上-lm参数,编译器中可能存在多个版本libm.a,可以以绝对路径指定库文件
GCC_STDLIB_TARGET_PATH=thumb\v7\nofp STDLIB+=\ $(GCC_INSTALL_PATH)\arm-none-eabi\lib\$(GCC_STDLIB_TARGET_PATH)\libm.a $(IMAGE_BUILD_DIR)/$(IAMGE).elf: $(TARGET_COMMPILE_DIRS) @echo --------------link [$@]---------------------- @SETLOCAL ENABLEDELAYEDEXPANSION & \ (for /f "delims=" %%i in ('type $(subst $(strip /),\,$(COMLIED_LIB_LIST_FILE))') do (set ret=!ret!%%i)) & \ (echo $(LD) $(LDFLAGS) $(U_LDFLAGS) -Map $(IMAGE_BUILD_DIR)/$(IAMGE).map -o $@ --whole-archive !ret! $(DEFAULT_LIBS) --no-whole-archive $(U_LIBS) $(STDLIB)) & \ ($(LD) $(LDFLAGS) $(U_LDFLAGS) -Map $(IMAGE_BUILD_DIR)/$(IAMGE).map -o $@ --whole-archive !ret! $(DEFAULT_LIBS) --no-whole-archive $(U_LIBS) $(STDLIB)) & \ ENDLOCAL
相关文章
- 问题-Delphi2007跟踪变量时提示“E2171 Variable 'APolygon' inaccessible here due to optimization”
- ORA-27125: unable to create shared memory segment
- [Angular] Introduction to Angular Internationalization (i18n)
- [Testing] Config jest to test Javascript Application -- Part 3
- [Falcor] Indroduce to Model
- [Javascript] Use requestIdleCallback to schedule JavaScript tasks at an optimal time
- postman测试重定向接口,We're sorry but system-cn doesn't work properly without JavaScript enabled. Please enable it to continue
- ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE
- when is IBASE status changed from inital to created - not answered
- You currently don‘t have access to this membership resource. To resolve this issue, agree to the lat
- 已解决One or more issues caused the setup to fail.Please fix the issues and then retry setup.For more i
- PyTricks-How to Sort a Python dict
- Introduction to Spring AOP
- 【错误记录】编译 Linux 内核报错 ( Unable to find the ncurses package. )
- Linux QtCreator 编译报错:No rule to make target '.../***' needed by '***.o'.stop
- AS编译的报错提示:Failed to query the value of property ‘namespace‘
- fatal: unable to access ‘https://github.com/用户名/项目名.git/‘: OpenSSL SSL_read: Connection was reset, e