Search code examples
c++embeddednios

Getting an "Type alt_up_character_lcd_dev could not be resolved" error


I've been working on try to display anything on the LCD screen using the Nios processor and the DE10-Lite board for weeks. I finally found a code that may help, but the I've been unable to shake off this error message, the code I found is

#include <string.h>
#include <system.h>
#include <altera_up_avalon_character_lcd.h>


int main(void)
{
 alt_up_character_lcd_dev * char_lcd_dev;

// open the Character LCD port
char_lcd_dev = alt_up_character_lcd_open_dev ("/dev/character_lcd_0");

if ( char_lcd_dev == NULL)
alt_printf ("Error: could not open character LCD device\n");
else
alt_printf ("Opened character LCD device\n");

/* Initialize the character display */
alt_up_character_lcd_init (char_lcd_dev);

/* Write "Welcome to" in the first row */
alt_up_character_lcd_string(char_lcd_dev, "Welcome to");

/* Write "the DE2 board" in the second row */
char second_row[] = "the DE10 Lite";
alt_up_character_lcd_set_cursor_pos(char_lcd_dev, 0, 1);
alt_up_character_lcd_string(char_lcd_dev, second_row);
}

the error is on the second line after int main(void) writing alt_up_character_lcd_dev * char_lcd_dev;

I'm using a DE10-Lite board, the platform designer for the connections and a 16x2 LCD OSEPP screen.

How do I fix this error?


Solution

  • In the header, the typedef uses the same name (alt_up_character_lcd_dev) for both the struct tag and the typedef alias.

    My assumption is that your compiler is confused by this. (but gcc doesn't have this issue)

    To fix it,

    struct alt_up_character_lcd_dev* char_lcd_dev;
    

    might help.