Forum Discussion
Altera_Forum
Honored Contributor
15 years agoNIOS error message
Hi people, I'm compiling the code in the NIOS IDE, and have some errors. Does anybody know what these errors are, and how to fix it? Thanks in advance. /cygdrive/c/altera/91/nios2eds/b...
Altera_Forum
Honored Contributor
15 years agoThanks Slacker,
This is the code i compiled:#include "sys/alt_stdio.h"# include "stdio.h"# include "string.h"# include "system.h"
int main()
{
char* msg = "Detected character\n";
FILE* fp;
char prompt = 0;
printf("Testing begin\n");
fp = fopen ("/dev/uart_0","r+");
if (fp)
{
while (prompt!=0)
{
prompt = getc(fp);
if (prompt=='t')
{
fwrite (msg,strlen(msg),1,fp);
}
}
fprintf(fp,"closing\n");
fclose(fp);
}*/
return 0;
}In the system library, if the "small C library" is unchecked, the errors are: /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/libc.a(closer.o) In function `_close_r':
/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/libc.a(lseekr.o) In function `_lseek_r':
/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/libc.a(openr.o) In function `_open_r':If the "small C library" is checked, the errors are:
undefined reference to `fopen'
undefined reference to `fopen'
undefined reference to `fopen'Is there any mistakes in my code, or my project configuration? Thanks in advanced!