Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

NIOS II stdio.h: Unresolved Inclusion error

Hi guys,

I'm using the NIOS II C editor that comes with Quartus 11sp1 web edition. When creating any code which uses stdio.h (or any other standard C library) it gives me an "Unresolved inclusion: <stdio.h>" error. Yet, this doesn't happen for any of the Altera specific libraries. Also, it complains that "NULL" is undeclared. My code is below.

Do you have any ideas what might be causing this and/or how to fix it?

thanks,

-Max


# include <stddef.h>  //gives an error
# include <stdio.h>   //gives an error
# include <sys/alt_alarm.h> //no error
# include <alt_types.h>   //no error
//Global definitions
# define MAX 3000
# define ALARMTICKS 1500
//Function declarations
void    prototype_os(); 					//The OS main entry point
alt_u32 myinterrupt_handler (void* context); //Interrupt handler for the system alarm
//Global object declarations
static alt_alarm os_alarm;
int main()
{
	printf("this is a test\n");
	prototype_os();
	return 0;
}
void prototype_os()
{
	while (1)
	{
		//Initialize timer
		if (alarm_start(&os_alarm, ALARMTICKS, myinterrupt_handler, NULL) < 0)
		{
			printf("No system clock was available\n");
		}
		alt_printf("This is the prototype OS for my exciting CSE351 projects!\n");
		int j = 0;
		for (j= 0; j < MAX; j++)
		{
			//do nothing... for now!
		}
	}
}
alt_u32 myinterrupt_handler (void* context)
{
	alt_printf("Interrupted by the timer!\n");
	return ALARMTICKS;
}

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi guys,

    I'm using the NIOS II C editor that comes with Quartus 11sp1 web edition. When creating any code which uses stdio.h (or any other standard C library) it gives me an "Unresolved inclusion: <stdio.h>" error. Yet, this doesn't happen for any of the Altera specific libraries. Also, it complains that "NULL" is undeclared. My code is below.

    Do you have any ideas what might be causing this and/or how to fix it?

    thanks,

    -Max

    # include <stddef.h>  //gives an error# include <stdio.h>   //gives an error# include <sys/alt_alarm.h> //no error# include <alt_types.h>   //no error
    //Global definitions# define MAX 3000# define ALARMTICKS 1500
    //Function declarations
    void    prototype_os();                     //The OS main entry point
    alt_u32 myinterrupt_handler (void* context); //Interrupt handler for the system alarm
    //Global object declarations
    static alt_alarm os_alarm;
    int main()
    {
        printf("this is a test\n");
        prototype_os();
        return 0;
    }
    void prototype_os()
    {
        while (1)
        {
            //Initialize timer
            if (alarm_start(&os_alarm, ALARMTICKS, myinterrupt_handler, NULL) < 0)
            {
                printf("No system clock was available\n");
            }
            alt_printf("This is the prototype OS for my exciting CSE351 projects!\n");
            int j = 0;
            for (j= 0; j < MAX; j++)
            {
                //do nothing... for now!
            }
        }
    }
    alt_u32 myinterrupt_handler (void* context)
    {
        alt_printf("Interrupted by the timer!\n");
        return ALARMTICKS;
    }
    

    --- Quote End ---

    You can try this:

    1. in the menu Project>properties

    2. Select the C/C++ General>Paths and symbols

    3. In the GNU C click en "Add"

    4. put the path where the standard library is allocated

    for example <altera installation directory>\quartus\bin64\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include

    you can find the path in our computer, it could change a bit depending on the Quartus version you are using.

    5. click OK

    6. Click Apply

    7. Rebuild Index

    8. Have fun

    :)