The 32nd NiosII Processor Data Master address bit is used to make uncached memory-mapped peripheral access. It means whichever slave you want to make uncached access, either a memory or another device, must have it's address bit 31 set to 1, that's why we do ADDR | 0x80000000 (pay attention to the number of zeroes used here!). So if you have
# define ONCHIP_MEM_BASE 0x8000
when you access the address 0x80008000 you will be making an uncached access to your memory.
The line you suggested would print and address rather than memory content, and it would cache its contents.
printf("%d\n",ONCHIP_MEM_BASE+(n-1))
You should make it a pointer of the correct type and then deference it, like this:
printf("%d\n",*((int *)((0x80000000|ONCHIP_MEM_BASE)+(n-1)*4)));
Note that I'm multiplying the index by four, that's because I'm casting the address to int, then each new int would be located for bytes apart from the other.
You might as well prefer to use my explicit pointer aproach, where you would
int *pmem = (int *)(0x80000000 | ONCHIP_MEM_BASE);
and then
printf("%d\n",pmem[n-1]);
which would be much more convenient.
The "Errors exist in a required project." should be further researched upon in order to be fixed. You should look for additional info in the "Problems" tab or in the "Console" tab. In the "Problems" tab you may see old compilation errors, so you may want to delete the errors before each compilation. In the "Console" tab you should click on the "screen" icon in the right side of the tabs bar, with the tooltip "Display Selected Console", and the select the console containing the compiler output. You may look for compilation errors there.
I'm not very comfortable with Eclipse. If you prefer you can switch to the command line interface in order to debug. You can right click the project and select "Nios II" and then "Nios II Command Shell" in order to open a console where you can work from. You can then "make clean_all; make" and look for errors there. This is my preferred work flow (though I don't even open Eclipse).