[linux-audio-dev] Compiler options: linking libsndfile to my app

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] Compiler options: linking libsndfile to my app
From: Doru-Catalin Togea (doru-cat_AT_ifi.uio.no)
Date: Tue Mar 19 2002 - 21:18:49 EET


Hi!

I am writing an audio app using libsndfile, and I do not know how to link
the libsndfile libray into my application. I successfully compiled the
libsndfile library with all its examples and test utilities. (by means of
"configure", which generated awfully complicated Makefiles, and
"make" which didn't exit with errors.)

For my application, I have the following directory structure:

prog/libsndfile/src/ - contains lots of .c .h .o + Makefiles
prog/libsndfile/examples/ contains .c .o, executables + Makefiles
...
prog/cdt_test/ contains cdt2.cpp + (my) Makefile

(my) Makefile is as follows:

------------------------------------------
LIBSNDFILE_SRC = ../libsndfile-0.0.27/src

cdt2: cdt2.o
        g++ cdt2.o -o cdt2

cdt2.o: cdt2.cpp
        g++ -I$(LIBSNDFILE_SRC) -c cdt2.cpp
------------------------------------------

When I compile I get the following:

     g++ -I../libsndfile-0.0.27/src -c cdt2.cpp
     g++ cdt2.o -o cdt2
     cdt2.o: In function `play(int, char **)':
     cdt2.o(.text+0x54): undefined reference to `sf_open_read'
     cdt2.o(.text+0x69): undefined reference to `sf_perror'
     cdt2.o(.text+0xcf): undefined reference to `sf_read_short'
     cdt2.o(.text+0x171): undefined reference to `sf_read_short'
     cdt2.o(.text+0x1aa): undefined reference to `sf_close'
     collect2: ld returned 1 exit status
     make: *** [cdt2] Error 1

An object file is made for my programme, but how do I link to the
neccesary libraries to resolve these undefined referances?

I guess all I need is in directory prog/libsndfile/src/ which contains
both .o files and a file called "libsndfile.la".

Anyone who knows what a .la file is?

I appreciate your help.

Catalin

        <<<< ================================== >>>>
        << We are what we repeatedly do. >>
        << Excellence, therefore, is not an act >>
        << but a habit. >>
        <<<< ================================== >>>>


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Mar 19 2002 - 21:06:37 EET