Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

undefined reference to fseek

Hello everyone i am doing edge detection on de2-115 using quartus and nios2.

When i tried to build my project it shows me errors like undefined reference to fseek, fread, fopen. i have included all header files like stdio.h and stdlib.h

Can anyone tell me how to solve this errors.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    You also need to link in the library that contains those functions. See the software development documentation for details. This post also has some good information. http://www.alteraforum.com/forum/showthread.php?t=37240

    --- Quote End ---

    I was implementing edge detection on nios2. when i run the c program for edge detection i was getting this errors like undefined reference to fseek, fopen, fread, fopen and others were regarding on chip memory overflow. so I did setting on bsp

    1:Settings --> Common --> hal --> enable_small_c_library

    2:"hal.enable_small_c_library"

    So it cleared all errors regarding Fseek and others undefined reference but I have still this errors.

    Do you know how to solve this one

    Thankshttp://www.alteraforum.com/forum/attachment.php?attachmentid=12069&stc=1
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That error is caused because as it says, your object code is too large to fit in the on-chip memory. You can either move your code to sram or sdram, or enlarge the on-chip memory (if possible), or shrink your object code by going back to the small C library and not using fopen, fread, fseek, etc.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello again,

    I have enlarge the on chip memory size and disable small c library. So now I am running my program its just giving one printf statement.

    in my C program It has one input image and output will give me edge detected image. My question where I have to put my source images. I have kept it in the folder where my helloworld program is stored. Is it right ??

    Thanks