Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

compiler error

Altera_Forum
Honored Contributor II
1,775 Views

I am trying to build and run the simple socket server template and I am getting the following error from the linker. 

 

could someone please explain to me the following error: 

 

======================================================== 

[BSP build complete] 

Info: Linking NiosSystem.elf 

nios2-elf-g++ -T'../NiosSystem_bsp//linker.x' -msys-crt0='../NiosSystem_bsp//obj/HAL/src/crt0.o' -msys-lib=ucosii_bsp -L../NiosSystem_bsp/ -Wl,-Map=NiosSystem.map -O0 -g -Wall -EL -mhw-div -mhw-mul -mno-hw-mulx -o NiosSystem.elf -lm  

../NiosSystem_bsp/\libucosii_bsp.a(alt_main.o): In function `alt_main': 

c:/altera/Projects/GaitID/NiosIIfDesign/software/NiosSystem_bsp/HAL/src/alt_main.c:154: undefined reference to `main' 

../NiosSystem_bsp/\libucosii_bsp.a(dm9000a.o): In function `prep_dm9000a': 

c:/altera/Projects/GaitID/NiosIIfDesign/software/NiosSystem_bsp/drivers/src/dm9000a.c:204: undefined reference to `get_mac_addr' 

../NiosSystem_bsp/\libucosii_bsp.a(alt_iniche_dev.o): In function `iniche_devices_init': 

c:/altera/Projects/GaitID/NiosIIfDesign/software/NiosSystem_bsp/iniche/src/alt_iniche_dev.c:118: undefined reference to `get_ip_addr' 

collect2: ld returned 1 exit status 

make: *** [NiosSystem.elf] Error 1 

======================================================== 

 

what should I do? how can I fix that? 

0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
646 Views

BTW I am using Eclipse.

0 Kudos
Altera_Forum
Honored Contributor II
646 Views

Do you have main(), get_mac_addr(), and get_ip_addr() functions in your application code? If memory serves, I believe you _ have_ to provide these for Interniche to function. 

 

Look at the examples to get an idea of what you need to do.
0 Kudos
Altera_Forum
Honored Contributor II
646 Views

yes. I have these functions in the application code.

0 Kudos
Altera_Forum
Honored Contributor II
646 Views

Hi! 

even if this is a very old thread I would like to post an answer for this problem because I was not able to find anything helpful in the web. 

This is problem occurred when I tried to recreate and rebuilt my project when I didn't completely remove all files from the /sftware/project_sources directory. 

Here what you simply need to do: 

copy your sources in software directory for example 

delete the two folders /sftware/project_sources and /sftware/project_bsp_sources 

then recreate properly your bsp from eclipse (if you're under windows run it in administrator mode) 

add your sources in /sftware/project_sources 

built all 

everything should be working fine. 

 

hope this will help someone.
0 Kudos
Altera_Forum
Honored Contributor II
646 Views

 

--- Quote Start ---  

I am also encountering the same thing! 

--- Quote End ---  

 

 

Hi KennyJRice, 

you still have the same error even after trying what I described in my precedent answer ? !
0 Kudos
Altera_Forum
Honored Contributor II
646 Views

I can contribute to the thread, that way of solving the problem have been useful for me too.i've just deleted all the sources of previously genereted bsp and generate them one more time. Afer that the build had been comleted successfully. Thanks for advice.

0 Kudos
Reply