2017-01-26 2 views
1

Ich habe Probleme beim Verknüpfen mit der Libpng-Bibliothek. Der Build scheint keine Referenzen auf Libpng-Aufrufe zu definieren. Ich denke, das Problem ist in meiner Libpng-Installation.Fehler beim Verknüpfen mit LibPng-Bibliothek

ich auf einem Win7 Laptop im Mingw Umgebung bin runing Meine Build-Umgebung ist wie folgt:

My path starts with C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\git\cmd;C:\Program Files 


C:\Users\Bob\Home\png23d>g++ --version 
g++ (GCC) 5.3.0 

I have built and installed libpng-1.6.28 which creates the following: 
C:\MinGW\bin> 
    libpng-config 
    libpng16-config 
    libpng16.dll 

C:\MinGW\include\libpng 
    png.h 
    pngconf.h 
    pnglibconf.h 

C:\MinGW\include\libpng16 
    png.h 
    pngconf.h 
    pnglibconf.h 

C:\MinGW\lib\pkgconfig 

C:\MinGW\lib> 
    libpng.a 
    libpng.dll.a 
    libpng16.a 
    libpng16.dll.a 

a symbolic link `libpng' to `libpng16' 
a symbolic link `libpng.pc' to `libpng16.pc' 
a symbolic link `libpng.a' to `libpng16.a' 
a symbolic link `libpng-config' to `libpng16-config 

, wenn ich versuche, ein Programm zu bauen "png23d" Ich erhalte den folgenden

C:\Users\Bob\Home\png23d>make 
g++ -DUSE_LIBPNG -lpng png23d.o option.o bitmap.o mesh.o mesh_gen.o mesh_index.o mesh_simplify.o out_pgm.o out_rscad.o out_pscad.o out_stl.o -o png23d 

bitmap.o:bitmap.c:(.text+0x102): undefined reference to `png_sig_cmp' 
bitmap.o:bitmap.c:(.text+0x142): undefined reference to `png_create_read_struct' 
    . 
    . 
    . 
bitmap.o:bitmap.c:(.text+0x418): undefined reference to `png_read_end' 
bitmap.o:bitmap.c:(.text+0x466): undefined reference to `png_destroy_read_struct' 
collect2.exe: error: ld returned 1 exit status 
<builtin>: recipe for target 'png23d' failed 
make: *** [png23d] Error 1 

Ich bin mir fast sicher, dass es die -lpng ist, die nicht funktioniert .... Ich weiß nur nicht, wie ich es beheben kann. Ich vermute, dass es ein symbolisches Linkproblem ist und ich weiß, dass ich während des libpng-Builds keins erstellt habe. Wenn ich Recht habe, muss ich es mit verknüpfen.

Ich habe versucht, -lpng zu -llpng16 zu ändern. Es machte keinen Unterschied.

Danke von der Eingabeaufforderung, die gut funktionieren. müssen nur herausfinden, wie man die make-Datei ändert.

#!/usr/bin/make 
# 
# png23d is a program to convert png images into 3d files 
# 
# Copyright 2011 Vincent Sanders <[email protected]> 
# 
# Released under the MIT License, 
# http://www.opensource.org/licenses/mit-license.php 

CC = g++ 

VERSION=100 

PREFIX = 

WARNFLAGS = -W -Wall -Wundef -Wpointer-arith \ 
     -Wcast-align -Wwrite-strings -Wstrict-prototypes \ 
     -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \ 
     -Wnested-externs 
ifneq ($(GCCVER),2) 
    WARNFLAGS += -Wno-unused-parameter 
endif 

OPTFLAGS=-O2 
#OPTFLAGS=-O0 

CFLAGS+=$(WARNFLAGS) -MMD -DVERSION=$(VERSION) $(OPTFLAGS) -g 

LDFLAGS+= -DUSE_LIBPNG -lpng 

PNG23D_OBJ=png23d.o option.o bitmap.o mesh.o mesh_gen.o mesh_index.o mesh_simplify.o out_pgm.o out_rscad.o out_pscad.o out_stl.o 

.PHONY : all clean 

all:png23d 

png23d:$(PNG23D_OBJ) 

-include $(PNG23D_OBJ:.o=.d) 

-include test/Makefile.sub 

clean: testclean 
    ${RM} png23d $(PNG23D_OBJ) *.d *~ png23d.png 

install:png23d 
    install -D png23d $(DESTDIR)$(PREFIX)/bin 

install-man:png23d.1 
    install -D png23d.1 $(DESTDIR)$(PREFIX)/share/man/man1 

# logo creation 
png23d.png:png23d.pov 
    povray +L/usr/share/povray/include/ -D +Q11 [email protected] +UV +UL +A0.2 +FP8 +W400 +H300 $< 

Antwort

0

Verschieben Sie -lpng nach den Objektdateien.

+0

Danke von der Eingabeaufforderung, die gut funktionieren. Ich muss nur herausfinden, wie man das Makefile ändert. Makefile zur Hauptfrage hinzugefügt –

+0

@RobertWorkman Versuchen Sie stattdessen, '-lpng' auf' LDLIBS' zu setzen (siehe [make docs] (https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter /make_10.html) für detaillierte Informationen über implizite Makefile-Regeln). – yugr

Verwandte Themen