将jpeglib链接到makefile中

问题描述 投票:1回答:1

[嗨,我正在尝试在代码中使用jpeglib,但无法将其与我的Makefile链接我将其下载到tar.gz文件中,然后将其解压缩并完成了所有./configure,制造商和所有这些工作,但是现在我必须将其链接到Makefile中,我不知道Makefile

CFLAGS+= -Wall -Werror -fPIE -std=gnu99 -g
LDFLAGS=  -pthread 

HW=prgsem
BINARIES=prgsem

#LDFLAGS += -L/usr/local/lib -ljpeglib
#CXXFLAGS += -I/usr/local/include
CFLAGS+=$(shell sdl2-config --cflags)
LDFLAGS+=$(shell sdl2-config --libs) -lSDL2_image



all: ${BINARIES}

OBJS=${patsubst %.c,%.o,${wildcard *.c}}

prgsem: ${OBJS}
    ${CC} ${OBJS} ${CXXFLAGS}  ${LDFLAGS} -o $@

${OBJS}: %.o: %.c
    ${CC} -c ${CFLAGS}  $< -o $@

clean:
    rm -f ${BINARIES} ${OBJS}

评论的内容是我尝试过的,没有起作用的。我也尝试更改#include本身。尝试过#include "jpeglib.h"#include <jpeglib.h>无效。

编辑:添加了make编译错误消息

cc xwin_sdl.o event_queue.o prg_io_nonblock.o gui.o main.o prgsem.o messages.o keyboard.o computation.o utils.o   -pthread  -L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2 -lSDL2_image -o prgsem
/usr/bin/ld: gui.o: in function `save_img':
/home/peter/Cprog/bab36prga-sem/gui.c:67: undefined reference to `jpeg_std_error'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:69: undefined reference to `jpeg_CreateCompress'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:74: undefined reference to `jpeg_stdio_dest'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:81: undefined reference to `jpeg_set_defaults'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:83: undefined reference to `jpeg_start_compress'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:90: undefined reference to `jpeg_write_scanlines'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:93: undefined reference to `jpeg_finish_compress'
/usr/bin/ld: /home/peter/Cprog/bab36prga-sem/gui.c:97: undefined reference to `jpeg_destroy_compress'
collect2: error: ld returned 1 exit status
make: *** [Makefile:19: prgsem] Error 1

感谢您的回答。

c makefile
1个回答
0
投票

您的问题不在程序的[[compilation

© www.soinside.com 2019 - 2024. All rights reserved.