Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHi,
I have the same problem with Quartus 13 / Nios II EDS 13.0. It's a linker error. You can try to add manualy "-lm" option for the linker but no effect on my computer. http://www.kirikoo.net/images/14Anonyme-20130716-104232.png
**** Build of configuration Nios II for project test_math ****
make all
Info: Building D:/test_math_bsp/
make --no-print-directory -C D:/test_math_bsp/
Info: Compiling hello_world.c to obj/default/hello_world.o
nios2-elf-gcc -xc -MP -MMD -c -ID:/test_math_bsp//HAL/inc -ID:/test_math_bsp/ -ID:/test_math_bsp//drivers/inc -DSYSTEM_BUS_WIDTH=32 -pipe -D__hal__ -DALT_NO_INSTRUCTION_EMULATION -DALT_SINGLE_THREADED -O0 -g -Wall -EL -mhw-div -mhw-mul -mhw-mulx -o obj/default/hello_world.o hello_world.c
hello_world.c: In function 'main':
hello_world.c:23: warning: unused variable 'test'
Info: Linking test_math.elf
nios2-elf-g++ -T'D:/test_math_bsp//linker.x' -msys-crt0='D:/test_math_bsp//obj/HAL/src/crt0.o' -msys-lib=hal_bsp -LD:/test_math_bsp/ -Wl,-Map=test_math.map -O0 -g -Wall -EL -mhw-div -mhw-mul -mhw-mulx -o test_math.elf obj/default/hello_world.o -lm
obj/default/hello_world.o: In function `main':
D:\test_math/hello_world.c:23: undefined reference to `cos'
collect2: ld returned 1 exit status
make: *** Error 1
**** Build Finished ****
# include <stdio.h># include <math.h>
int main()
{
printf("Hello from Nios II!\n");
double test = cos(3.14);
return 0;
}
It seems Altera has some problems with tests before releasing theirs softwares...