undefined reference to `ceilf'

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

undefined reference to `ceilf'

Jump to solution
1,065 Views
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 Kudos
Reply
1 Solution
1,043 Views
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, 

View solution in original post

2 Replies
1,044 Views
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,039 Views
Hrohn
Contributor II

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