undefined reference to

Benjamin Gilbert bgilbert at cs.cmu.edu
Mon Feb 2 15:28:22 EST 2015


On 02/02/2015 03:14 PM, Freed, Melanie wrote:
> g++ -Wall -I/usr/local/include/openslide -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include -L/usr/lib -lm -lglib-2.0 -o AccessSlides
> AccessSlides.cc
> /tmp/cc7Nmv18.o: In function `main':
> AccessSlides.cc:(.text+0x11): undefined reference to `openslide_get_version'
> collect2: error: ld returned 1 exit status

You're not actually linking against OpenSlide.  You'll need to add 
"-L/usr/local/lib -lopenslide" to your command line.  (Even better, get 
the requisite compiler flags through pkg-config: add "$(pkg-config 
--cflags --libs openslide)" instead, drop 
"-I/usr/local/include/openslide", and make sure /usr/local/lib/pkgconfig 
is in your PKG_CONFIG_PATH.)

--Benjamin Gilbert



More information about the openslide-users mailing list