• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Using libAfter

Hi,

I'm trying to do some image manipulation in an app I'm writing in C. I compiled and installed libAfter-0.92 with default configuration (static libraries).

When I try to compile my code (gcc 3.2), with:

gcc -lAfterBase -lAfterImage main.c -o test
or
gcc -L/usr/local/lib -lAfterBase -lAfterImage main.c -o test
or
gcc -L/usr/local/lib -lAfterBase -lAfterImage --static main.c -o test
(doesn't seem to matter)

I get a "/tmp/blabla.o: undefined reference to *function name*" for every function that's supposed to be in the libAfter libraries.

I also #include'ed libAfterImage/afterimage.h and libAfterImage/afterbase.h
0
herr_apfelschnitt
Asked:
herr_apfelschnitt
  • 4
  • 4
  • 2
  • +1
1 Solution
 
akshayxxCommented:
gcc main.c -o test
 -L/usr/local/lib -lAfterBase -lAfterImage
the libraries to be linked should be specified at the end
0
 
akshayxxCommented:
u'll also have to provide the include path.. where are ur include header files lying
0
 
ahoffmannCommented:
does following return an entry with  T

  nm -gop /usr/local/lib/libAfterBase*|grep "function name"
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
herr_apfelschnittAuthor Commented:
Lol. Kind of a pretty dumb mistake. It works fine now. (had to link some more libraries though)
0
 
herr_apfelschnittAuthor Commented:
Still wondering why gcc won't give an error message otherwise...
0
 
bryanhCommented:
>Still wondering why gcc won't give an error message
>otherwise...

Other than what?  It looks to me like Gcc does give an error message when you don't link in the required libraries.
0
 
herr_apfelschnittAuthor Commented:
Yes, but why it doesn't give an error message when you give the arguments in the wrong order.
0
 
bryanhCommented:
There's nothing in this question about arguments being in the wrong order.  Can you give an example of giving arguments in the wrong order and not getting an error message?
0
 
herr_apfelschnittAuthor Commented:
Check my question: If I supply the libraries to be linked before the name of the source file I want to compile, it doesn't seem to link the libraries at all. However, gcc doesn't give a specific error message about the arguments, it just tells me it can't find those functions.
0
 
akshayxxCommented:
once i also observed similar behaviour ..
if u wish follow up the following discussion
http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20393213.html
0
 
akshayxxCommented:
though my case was weird enough that .. same compilation command worked on gcc on aix .. but didnt work with my gcc on linux..
i dont remember exactly if i had same versions of gcc on both.. because sometime around that  i upgraded one of my gcc
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now