This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

about the link error with arm-none-eabi on the eclipse environment.

Hello all

I'm struggling with link errors, "undefined referencce atan2" as well as all math library. I still dont know why it is occurred these errors. I configured the eclipse compile environment with the gnu arm tool using your doc, application note ver1.2. May you help me?

Parents
  • I can compile the attached math-lib.zip. However if I change the the argument to a variable I get following error.

    main.c:(.text.startup+0x5a): undefined reference to `atan2'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/template_project_gcc_s110_xxaa.out] Fehler 1
    

    My main is:

    
    int main(void)
    {	
    	uint8_t idx = 0;
    	double d_idx = 0.0;
    	uint8_t buffer[20];
    	simple_uart_config(0, 17, 0, 16, false);
    	simple_uart_putstring((uint8_t *)"Start\r\n");
    	nrf_gpio_range_cfg_output(8, 15);
    	
    	while (true)
        {
    		idx++;
    		d_idx = (double) idx;
    		float result = atan2(1.0, d_idx);
    		sprintf((char *)buffer, "%f\r\n", result);
    		simple_uart_putstring(buffer);
    		nrf_delay_us(100000);
        }
    }
    

    How can I build this?

    Greetings Markus

Reply
  • I can compile the attached math-lib.zip. However if I change the the argument to a variable I get following error.

    main.c:(.text.startup+0x5a): undefined reference to `atan2'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/template_project_gcc_s110_xxaa.out] Fehler 1
    

    My main is:

    
    int main(void)
    {	
    	uint8_t idx = 0;
    	double d_idx = 0.0;
    	uint8_t buffer[20];
    	simple_uart_config(0, 17, 0, 16, false);
    	simple_uart_putstring((uint8_t *)"Start\r\n");
    	nrf_gpio_range_cfg_output(8, 15);
    	
    	while (true)
        {
    		idx++;
    		d_idx = (double) idx;
    		float result = atan2(1.0, d_idx);
    		sprintf((char *)buffer, "%f\r\n", result);
    		simple_uart_putstring(buffer);
    		nrf_delay_us(100000);
        }
    }
    

    How can I build this?

    Greetings Markus

Children
No Data
Related