- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Everyone,
I have a probelm with using Nios II Build for Eclipse... I wrote a small C program trying to read from a file, and I get an error "C:\altera\mysopc_nios_sram\software\mySRAM_image/hello_world_small.c:117: undefined reference to `fopen' my program is very simple, and I am including all the correct includes # include "sys/alt_stdio.h"# include <stdio.h># include <string.h># include <stdlib.h># include "system.h"# include "altera_avalon_pio_regs.h" ............... if( ( InputFile1 = fopen(name_in1, "r") ) == NULL) printf("Input File 1 can not be opened \n"); please help, Thank you :)Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't believe you can use "fopen" if you have the "small C library" option selected in the properties for your project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply, but what do I do then?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure what version of Nios you are using but in the past I have opened the system library properties and unchecked "use small C library". This will probably increase your program size so you may need to increase the amount of memory allocated for your program code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using Nios II 12.0 Software Build Tools for Eclipse, but I don't know where to uncheck "use small C library" ? I looked all over the place, but couldn't find it. Any ideas?
Thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I solved the problem... Here is what I did:
1) I right clicked on my project and choose Nios II --> BSP Editor 2) on the left hand side options where it says "settings" I chose Settings --> Common --> hal --> enable_small_c_library 3) I unchecked "hal.enable_small_c_library" I rebuild the project and it compiled fine :) Thank you all for your help....- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad you figured it out.
I guess BSP is the new "system library" then.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for this info...

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page