GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Apr-2008, 15:07
J-M J-M is offline
New Member
 
Join Date: Apr 2008
Posts: 14
J-M is on a distinguished road

gzip linker problem boost::iostreams with zlib


Hi.

I'm trying to compile and link this simple program with boost::iostreams and zlib. Compilation goes well not a single error but I get lot of undefined references when linking.

Makefile:
Code:
SOCKETS_LIB = ../lib SOCKETS_INCLUDE = ../include BOOST_INCLUDE = C:\Boost\include\boost-1_35 BOOST_LIB = C:\Boost\lib ZLIB_LIB = C:\zlib123 ZLIB_INCLUDE = C:\zlib123 PLATFORM = win32-cygwin LIBS = -L $(SOCKETS_LIB) -lSockets LIBS += -L$(BOOST_LIB)\boost_iostreams-mgw34-mt.lib LIBS += -L $(ZLIB_LIB) -lzdll INCLUDE = -I $(SOCKETS_INCLUDE) -I $(BOOST_INCLUDE) -I $(ZLIB_INCLUDE) include $(SOCKETS_INCLUDE)/Makefile.version include $(SOCKETS_INCLUDE)/Makefile.Defines.$(PLATFORM) CPPFLAGS = $(CFLAGS) PROGS = main all: $(PROGS) main: main.o $(CXX) -o $@ $^ $(LIBS) clean: del -f *.o *~ slask *.d $(PROGS) -include *.d

main.cpp - an example from here http://www.boost.org/doc/libs/1_35_0/libs/iostreams/doc/classes/gzip.html

CPP / C++ / C Code:
#include <fstream>
#include <iostream>
#include <string>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <HttpGetSocket.h>
#include <SocketHandler.h>

using namespace std;

string url = "http://s3.travian.fi/dorf1.php";
string zipFile = "pellot.gz";
//string file = "pellot.html";

int main()
{
    SocketHandler h;
    HttpGetSocket s(h, url, zipFile);

    h.Add(&s);
    h.Select(1,0);
	while (h.GetCount())
	{
		h.Select(1,0);
	}
	if (s.Complete()){

		ifstream filein(zipFile.c_str(), ios_base::in | ios_base::binary);
		boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
		in.push(boost::iostreams::gzip_decompressor());
		in.push(filein);
		boost::iostreams::copy(in, cout);
	}

    return 0;
}
Generated compile and linking commands:
Code:
g++ -Wall -g -I ../include -I C:\Boost\include\boost-1_35 -I C:\zlib123 -MD -D_VERSION='"2.2.9"' -O2 -mno-cygwin -D_WIN32 -D__CYGWIN__ -c -o main.o main.cpp g++ -o main main.o -L ../lib -lSockets -LC:\Boost\lib\boost_iostreams-mgw34-mt.lib -L C:\zlib123 -lzdll -lws2_32

Errors:
Code:
main.o: In function `main': C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::zlib::default_compression' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::zlib::deflated' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::zlib::default_strategy' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' C:/Sockets-2.2.9/HTMLClient/main.cpp:22: undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()' C:/Sockets-2.2.9/HTMLClient/main.cpp:22: undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' C:/Sockets-2.2.9/HTMLClient/main.cpp:22: undefined reference to `boost::iostreams::detail::zlib_base::before(char const*&, char const*, char*&, char*)' C:/Sockets-2.2.9/HTMLClient/main.cpp:22: undefined reference to `boost::iostreams::zlib::sync_flush' C:/Sockets-2.2.9/HTMLClient/main.cpp:22: undefined reference to `boost::iostreams::detail::zlib_base::inflate(int)' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::detail::zlib_base::after(char const*&, char*&, bool)' C:/Sockets-2.2.9/HTMLClient/main.cpp:23: undefined reference to `boost::iostreams::zlib_error::check(int)' C:/Sockets-2.2.9/HTMLClient/main.cpp:21: undefined reference to `boost::iostreams::zlib::stream_end' C:/Sockets-2.2.9/HTMLClient/main.cpp:21: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)' C:/Sockets-2.2.9/HTMLClient/main.cpp:26: undefined reference to `boost::iostreams::zlib::okay' C:/Sockets-2.2.9/HTMLClient/main.cpp:25: undefined reference to `boost::iostreams::zlib::okay' main.o: In function `main': C:/Boost/include/boost-1_35/boost/iostreams/chain.hpp:466: undefined reference to `boost::iostreams::zlib::okay' main.o: In function `main': C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/streambuf:187: undefined reference to `boost::iostreams::zlib::okay' main.o: In function `main': C:/Boost/include/boost-1_35/boost/detail/sp_counted_base_gcc_x86.hpp:36: undefined reference to `boost::iostreams::zlib::okay' main.o:C:/Sockets-2.2.9/HTMLClient/main.cpp:12: more undefined references to `boost::iostreams::zlib::okay' follow collect2: ld returned 1 exit status gnumake: *** [main] Error 1

I have wrestled with this last three days and can't get it to work. I've compiled boost from source with --toolset=gcc so it should work with mingw like boost::regex-lib linked succesfully. One thing that bothers me with this iostreams lib-file is that is doesn't start with "lib" like regex, but it didn't report any problems when compiling it with bjam.

If you didn't undestand or you have some questions be free to ask.

Thanks in advance.

J-M
  #2  
Old 23-Apr-2008, 12:44
J-M J-M is offline
New Member
 
Join Date: Apr 2008
Posts: 14
J-M is on a distinguished road

Re: gzip linker problem boost::iostreams with zlib


No luck here..

Same problem still exists, but I moved on and now I'm trying to figure out how to decompress in memory gzipped data stored in a std::string with zlib.
Gzip-file is easy to decompress with zlib as it provides needed functions for it.

If someone can explain how to do this or provide me a link where it's done I'd appreciate it. In the meantime I'm trying to figure out what happens in gzio.c.

BR,
J-M
  #3  
Old 29-Apr-2008, 04:00
Peter_APIIT Peter_APIIT is offline
Regular Member
 
Join Date: May 2007
Location: Malaysia
Posts: 425
Peter_APIIT is on a distinguished road

Re: gzip linker problem boost::iostreams with zlib


I also want to know.
__________________
Linux is the best OS in the world.
 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple definition of `motor::adicionarthread()' kingpk C++ Forum 3 01-Apr-2008 07:37
problem about linker error Afroze C++ Forum 5 30-Aug-2007 11:24
need help with linker problem calin86 C++ Forum 5 27-Mar-2007 19:10
linker problem svenveer C Programming Language 6 17-Oct-2005 13:38
zlib and/or gzip SloppyGoat Apache Web Server Forum 4 17-Dec-2003 14:22

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:44.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.