初次使用nios开发大概率会在eclipse中遇到这个问题,比如
TypeType 'alt_u8' could not be resolved
TypeType 'alt_u16' could not be resolved
TypeType 'alt_u32' could not be resolved
1.头文件
首先查看是否有下面的头文件
#include <stdio.h>
#include <system.h> // 包含底层寄存器宏定义等
#include <altera_avalon_pio_regs.h> //PIO的寄存器和函数
#include <unistd.h>
#include <string.h>
#include <sys/alt_irq.h> // sys是中断头文件的目录,需要指定,不然找不到
#include <alt_types.h> //定义了常用的数据类型
其中<alt_types.h> //定义了常用的数据类型
typedef signed char alt_8;
typedef unsigned char alt_u8;
typedef signed short alt_16;
typedef unsigned short alt_u16;
typedef signed long alt_32;
typedef unsigned long alt_u32;
typedef long long alt_64;
typedef unsigned long long alt_u64;
2. 更改Indexer
右击工程选择project->properties->C/C++ General->indexer
如图勾选
3.Freshen All Files
Project -> C/C++ index -> Freshen All Files
4.重启eclipse
如果以上两步还不行,奇迹可能就在重启之后~