tags:

views:

130

answers:

2

Hi,

I am having liavcodec.a static library and header files of this library.

libavcodec.a

I added this library and their header files into my project and there is no error. I can see this library added in Target->Info->General and i have edited the Header Search Path also.

I can add header file #import “avcodec.h” into xcode project also. I can use all the variables which have been declared in structure of that file. But i am trying to use any function from that class, i am getting some errors like,

Test.m
—-
“-avcodec_register_all”, referenced from:
-[Test initialize] in Test.o
Symbol(s) not found
collect2: id returned 1 exit status
—-

Do you what is the problem?

Many thanks.

A: 

Just as a sanity check, verify that your library file contains the expected symbols; Type this in a terminal window (replacing path/to with the correct path):

nm -g /path/to/libavcodec.a | grep avcodec_register_all

(If the command's output is just a blank line, then the library file is probably corrupt).

tedge
Hi, i checked and i got this result "nm: archive: libavcodec.a contains no members that are object files". So my libray does not have .m class files?
iphonemobdev
It means the problem is with your library file, probably not with your Xcode project - I'd guess it's a build configuration issue, but that should probably be a separate stackoverflow question.
tedge
+1  A: 

Provide implementation of your [test initialize] method. Also provide the configuration command which you used to build the static library.

Try rebuilding the library, the method avcodec_register_all should be directly accessible through allcodecs.c file if the library is included in target and header search path is properly configured. Probably the library is corrupt, just as tedge says.

Raj
hi,I tried that command and i did not get anything.Actually i have to convert AAC to Mp3 in cocoa application so i got FFMPEG library code and i complied using ./configure, make and sudo make install. It did not create .dylib but it created this static library in /usr/local/lib. So i copied this static library and responding the headers files.Actually i could not add this library directly from Info->General. So i copied from there and i used in my project
iphonemobdev
./configure would build it for default configuration, say for desktop or machine. You will have to change the architecture so that it will be suitable for iPhone. You will have to build for ARM, all the details you can find it here: http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html
Raj
@"nm: archive: libavcodec.a contains no members that are object files"It means that the library is not built probably.
Raj
Hi Raj, i am not building this library for iphone. I am trying to use this library for Cocoa Application. But you are right that library is not build properly.
iphonemobdev