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++
12618 Discussions

Why none getchar(), getc, fgetc() work ?

Honored Contributor II

I built a embedded system in qsys which has the jtag_uart IP. Based on default set,jtag_uart is used as stdin, stdout. I create a hello world project and it can print hello world in console. 

But after I added the command like: 


getchar(), getc(), or fgetc(), then the program can't be build. It reports errors like: "undefined reference to 'getc' ". I copy my codes as below: 

# include <stdio.h># include "..\hello_world_bsp\HAL\inc\io.h"# include "..\hello_world_bsp\system.h" 

typedef unsigned int uint; 



int main() 



printf("Hello from Nios II!\n"); 

int c; 

c= getc(stdin); 


printf("This is from UART: %d", c); 





return 0; 



I also attached the screenshot. Why these functions which use jtag_uart to read don't work? Do I missed to include any files?  


Thanks in advance.
0 Kudos
1 Reply
Honored Contributor II

Anyone has idea? 


0 Kudos