使用一下程序:文件命hello_world.c
#include <excalibur.h>
int main(void)
{
int c;
nr_uart_txstring("Hello form nios uart, input a character:");
while((c=nr_uart_rxchar(na_uart1))==1);
nr_uart_txchar(c,0);
nr_uart_txcr();
nr_uart_txhex(c);
nr_uart_txcr();
nr_uart_txhex16(65535);
nr_uart_txcr();
nr_uart_txhex32(0x10000);
nr_uart_txcr();
}
错误提示如下:
**** Incremental build of configuration Debug for project hello_world_1 ****
make -s all
Compiling hello_world.c...
Linking hello_world_1.elf...
obj/hello_world.o(.text+0x18): In function `main':
../hello_world.c:43: undefined reference to `nr_uart_txstring'
obj/hello_world.o(.text+0x20):../hello_world.c:44: undefined reference to `nr_uart_rxchar'
obj/hello_world.o(.text+0x40):../hello_world.c:45: undefined reference to `nr_uart_txchar'
obj/hello_world.o(.text+0x44):../hello_world.c:47: undefined reference to `nr_uart_txcr'
obj/hello_world.o(.text+0x4c):../hello_world.c:48: undefined reference to `nr_uart_txhex'
obj/hello_world.o(.text+0x50):../hello_world.c:50: undefined reference to `nr_uart_txcr'
obj/hello_world.o(.text+0x58):../hello_world.c:51: undefined reference to `nr_uart_txhex16'
obj/hello_world.o(.text+0x5c):../hello_world.c:53: undefined reference to `nr_uart_txcr'
obj/hello_world.o(.text+0x68):../hello_world.c:54: undefined reference to `nr_uart_txhex32'
obj/hello_world.o(.text+0x6c):../hello_world.c:55: undefined reference to `nr_uart_txcr'
collect2: ld returned 1 exit status
make: *** [hello_world_1.elf] Error 1
Build completed
为什么会出现这样的编译错误?
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |