undefined reference to `ceilf'

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

undefined reference to `ceilf'

跳至解决方案
1,188 次查看
Hrohn
Contributor II

When I compile the project with S32DS for S32 Platform, I need to use the "float ceilf(float)" function. I have included the header file math.h in my C file, but the ceilf function is still not defined, what can I do?

0 项奖励
回复
1 解答
1,166 次查看
giraffe508
Contributor IV

Hi @Hrohn It seems like you are facing an issue with the linker not finding the reference to the `ceilf` function. To resolve this issue, you need to add the math library to your project's linker settings. Here's how you can do that:

  1. In S32 Design Studio, right-click on your project in the Project Explorer and select 'Properties.'
  2. Go to 'C/C++ Build' > 'Settings' > 'Cross ARM C++ Linker' > 'Libraries.'
  3. Click on the '+' button under 'Libraries (-l)' and add 'm' (without quotes) to the list. This will link the math library to your project.
  4. Click 'Apply' and then 'OK' to save the changes.
  5. Rebuild your project, and the linker should now find the reference to the `ceilf` function.

By following these steps, you should be able to resolve the undefined reference issue for the `ceilf` function in your S32DS project.
If you still face any issues, please provide more details about your project setup and configuration.

Regards, 

在原帖中查看解决方案

2 回复数
1,167 次查看
giraffe508
Contributor IV

Hi @Hrohn It seems like you are facing an issue with the linker not finding the reference to the `ceilf` function. To resolve this issue, you need to add the math library to your project's linker settings. Here's how you can do that:

  1. In S32 Design Studio, right-click on your project in the Project Explorer and select 'Properties.'
  2. Go to 'C/C++ Build' > 'Settings' > 'Cross ARM C++ Linker' > 'Libraries.'
  3. Click on the '+' button under 'Libraries (-l)' and add 'm' (without quotes) to the list. This will link the math library to your project.
  4. Click 'Apply' and then 'OK' to save the changes.
  5. Rebuild your project, and the linker should now find the reference to the `ceilf` function.

By following these steps, you should be able to resolve the undefined reference issue for the `ceilf` function in your S32DS project.
If you still face any issues, please provide more details about your project setup and configuration.

Regards, 

1,162 次查看
Hrohn
Contributor II

@giraffe508 Thanks for your reply. You helped me solve my problem.