You are here:

C/Using external functions

Advertisement


Question
Hello!
I'm quite new in C and i can't compile an example of the reed-solomon implementation, that i've taken here: http://www.beartronics.com/rscode.sourceforge.net/
while compiling it says smth like can't find libecc.a.
I deleted reference to this file in Makefile.
Now, it says:
"mingw32-make -f makefile all
gcc -o example example.o -L C:/MinGW/lib/gcc-lib/mingw32/3.2.3/ -lstdc++
example.o(.text+0x125): In function `main':
C:/Documents and Settings/User/workspace1/Reed-Solomon/example.c:66: undefined reference to `initialize_ecc'
example.o(.text+0x139):C:/Documents and Settings/User/workspace1/Reed-Solomon/example.c:71: undefined reference to `encode_data'
example.o(.text+0x1d1):C:/Documents and Settings/User/workspace1/Reed-Solomon/example.c:95: undefined reference to `decode_data'
example.o(.text+0x1d9):C:/Documents and Settings/User/workspace1/Reed-Solomon/example.c:98: undefined reference to `check_syndrome'
example.o(.text+0x1f0):C:/Documents and Settings/User/workspace1/Reed-Solomon/example.c:99: undefined reference to `correct_errors_erasures'
mingw32-make: *** [example] Error 1"

What's my problem? Why i can't use functions which are defined in other .c files???

I'm working in Windows , Eclipse CDT

Answer
> Removing the reference from Makefile is wrong.
> The best way is to find where this library exists on your system and give this
> library path to your compiler.
> If you don't have it installed on your machine, then install it and then compile
> this program again.
>
> A program will need all the dependencies to be taken care of before getting
> compiled.
Hi,

   I saw that, you have given a bad rating for this answer. Here is the rating that you have given:
Knowledge - 5
Clarity - 5
Time - 2
Polite - 10

   I don't know what answer you were expecting.
   I am not writing this message, to ask for a better rating.
   But, I want to understand what you were expecting.

   One thing you need to understand is that, from the data that you have given, can any other expert give a better answer on this.
   Also, I have already mentioned in my profile that, I work on Unix platform and your question is related to MS Windows.

   Still from the data that you have given, I have tried to explain what is happening and how to get it rectified.
   The error: "undefined reference", is coming because, you have removed the reference to library libecc.a from the Makefile.
   If the compiler was telling that, it couldn't find libecc.a, then you will have to provide the correct path from where it can find the library.

   I don't know, if you were expecting me to solve the problem without accessing your code, your system and your compiler!

   I am very sorry to see that you didn't like my answer.

Regards,
Narendra

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.