Lib issues: undefined references (libjpeg)

This is a discussion on Lib issues: undefined references (libjpeg) within the Linux Programming forums, part of the Platform Specific Boards category; I'm currently porting the texture loader code for my engine to Linux. For the JPEG loader, I include jpeglib.h, and ...

  1. #1
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070

    Lib issues: undefined references (libjpeg)

    I'm currently porting the texture loader code for my engine to Linux. For the JPEG loader, I include jpeglib.h, and libjpeg.so with -ljpeg. When I compile the program, I get errors such as "Textures.cpp:(.text+0x216): undefined reference to `jpeg_destroy_decompress(jpeg_decompress_struct*)' " with g++, even though I have included the header and am linking with the library.

    I'm new to programming on Linux, so this will probably have a simple solution that I don't know about.

    Thanks.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Try using "-L/path/to/libjped.so" and/or "-I/path/to/libjpeg.h"

    also, post the compilation command your using if that doesn't work.

  3. #3
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    Nope, didn't work .

    My makefile:
    Code:
    APP = Clockwork
    CC = g++
    FLAGS = -Wall -m elf_i386
    FLAGS64 = -Wall -m elf_x86_64
    OBJS = App.o Camera.o Engine.o Textures.o World.o
    IMG_LIBS = -ljpeg
    GLUI_LIBS = -Llib -lglui
    GL_LIBS = -lglut -lGL -lGLU
    LIBS = ${GL_LIBS} ${IMG_LIBS} -lXmu -lXext -lX11 -lXi -lm #-lmalloc 
    INC_DIR = -I/usr/X11R6/include -I/usr/include
    LIB_DIR = -L/usr/X11R6/lib -L/usr/lib
    LIB64_DIR = -L/usr/X11R6/lib64 -L/usr/lib64
    GLUT = ${GLUT_PATH}
    
    x86-64: $(OBJS)
    	$(CC) $(FLAGS64) $(GLUT) $(INC_DIR) $(LIB64_DIR) $(OBJS) $(GLUI_LIBS) $(LIBS) -o $(APP)
    	
    x86: $(OBJS)
    	$(CC) $(FLAGS) $(GLUT) $(INC_DIR) $(LIB_DIR) $(OBJS) $(GLUI_LIBS) $(LIBS) -o $(APP)
    	
    clean:
    	/bin/rm *.o
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  4. #4
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    I dont' see $(IMG_LIBS) on your compile line

    edit: nvm, i see it now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM
  4. Problem with OpenGL tutorial
    By 2Biaz in forum Windows Programming
    Replies: 18
    Last Post: 09-16-2004, 11:02 AM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21