Hi Chris,
From: Chris Gagnon <[EMAIL PROTECTED]>
RE: Re: Compiling PNGWriter 2004-11-06 16:15
I tried a bunch of the stuff in that email didn"t seem to get me past the
point I"m at.
The most vital thing you did not try was installing the library in a directory you own, as I suggested. Instead, you placed libpngwriter.a and pngwriter.h in your project's directory. Both will work, but my suggestions weren't for this second alternative, and this is why you did not get very far.
I"m going to try to give a better idea of the situation since
I"m pretty sure it"s something small I"m overlooking.
Files in the directory I"m building in:
Makefile libpngwriter.a pngwriter.h tile.o
map.dat mapgen.o tile.cc
mapgen.cc tile.h
I see you have decided not to install PNGwriter, and are going to leave it in the same directory as your project. There is nothing wrong with this, but you have to take this into account when specifying your compiler arguments.
Makefile: OBJS = mapgen.o tile.o libpngwriter.a
I'm not sure about this. I'm no Makefile guru, but this is not how one would include a library, as far as I know. Object files, yes, but libraries are included with the -l argument.
CXX = g++
DEBUG = -g
CFLAGS = -Wall -c -DNO_FREETYPE -lpng $(DEBUG) LFLAGS = -Wall $(DEBUG) mapgen: $(OBJS)
$(CXX) $(LFLAGS) $(OBJS) -o mapgen
mapgen.o: mapgen.cc
$(CXX) $(CFLAGS) mapgen.cc
tile.o: tile.h tile.cc
$(CXX) $(CFLAGS) tile.cc
default: mapgen
main: mapgen
all: mapgen
clean:
@rm -f *.o *~ mapgen
Make gives me these error(only showing first bunch of lines(about 50 lines
like theses))
g++ -Wall -g mapgen.o tile.o libpngwriter.a -o mapgen
Undefined first referenced
symbol in file
png_init_io libpngwriter.a(pngwriter.o)
png_read_info libpngwriter.a(pngwriter.o)
png_set_expand libpngwriter.a(pngwriter.o)
png_convert_from_time_t libpngwriter.a(pngwriter.o)
png_get_rowbytes libpngwriter.a(pngwriter.o)
png_destroy_read_struct libpngwriter.a(pngwriter.o)
.....
This looks like it cannot find libpng, though it is just a consequence of the following:
As I suggested in my last email, please add the appropriate arguments specifying where to find the PNGwriter library and pngwriter.h. Since you have placed them in the same directory as your project, you must tell your compiler where to find them. You need to do so with -L (for libraries) and -I (for header files). You have also omitted -lpngwriter and -lz (-lz may not be necessary). You got the above errors because pngwriter.h could not be found, and therefore png.h, the libpng header file, was not included, and so the libpng symbols in libpngwriter.a were not defined.
The following would be the correct PNGwriter-specific compiler arguments to compile your project (without FreeType2 support). Note: I have left out all other arguments.
g++ -DNO_FREETYPE -I/xxx/nnn -L/xxx/nnn -lpng -lpngwriter -lz
where /xxx/nnn is your project's directory.
Best of luck,
Paul
------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ http://pngwriter.sourceforge.net/ PNGwriter-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/pngwriter-users
