爱无线 发表于 2012-11-11 22:42:00

能不能帮忙看看NIOS ii 9.1在编译程序时的这个错误?

在Build project 时总是提示这个错误
/cygdrive/e/altera/nios2eds/components/altera_hal/HAL/src/alt_main.c undefined reference to `main'

能帮忙看看程序哪里错了吗?
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"

int main (void) __attribute__ ((weak, alias ("alt_main")));
int alt_main (void)
{
int led = 0;
int i;


while (1)
{
      led = 1-led;
      IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE, 1-led);
      for(i = 0;i<1000000;i++);   
}
return 0;
}

skycomm 发表于 2012-11-11 23:00:42

把 alt_main 改为别的名称试试看,alt_main 在nios2中的启动程序中好像有用到
页: [1]
查看完整版本: 能不能帮忙看看NIOS ii 9.1在编译程序时的这个错误?