Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 14th, 2006, 12:42 AM   #1
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
zlib in Visual studio

This is a fairly petty problem, but I hope that someone here has experienced it as well.
I am trying to use zlib with my program in Visual Studio .NET 2003. I recently included the zlib1.dll version 1.2.3.0 with my program. I then included zlib.h and zconf.h of the same version in my visual studio include folder. I recieved errors:
void Client::start(void)
{
	//no errors here
	zip.zalloc = Z_NULL;
	zip.zfree = Z_NULL;
	zip.opaque = Z_NULL;
	zip.avail_in = 0;
	zip.next_in = Z_NULL;

	//errors here, because it is a function
	int ret = inflateInit(&zip);
	if (ret != Z_OK) {
		crash();
		return;
	}

	//this function contains the same error
             run();

	//errors here too
	inflateEnd(&zip);
}
------------------------------------------------
Client.obj : error LNK2019: unresolved external symbol _inflate referenced in function "private: int __cdecl Client::run(void *)" (?run@Client@@AAAHPAX@Z)
Client.obj : error LNK2019: unresolved external symbol _inflateEnd referenced in function "public: void __thiscall Client::start(void)" (?start@Client@@QAEXXZ)
Client.obj : error LNK2019: unresolved external symbol _inflateInit_ referenced in function "public: void __thiscall Client::start(void)" (?start@Client@@QAEXXZ)
Debug/Console Dev1.exe : fatal error LNK1120: 3 unresolved externals
I then included the entire zlib source in a subdirectory and #included it. I got the same errors.

After a lot of reading, I am wondering if I need to make a .lib file. I have a .def file but I don't know how to use lib because it doesn't work from my command line. I don't especially want to go to all that effort if there is one available or this is a simple problem.
Harakim is offline   Reply With Quote
Old May 14th, 2006, 1:04 AM   #2
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
You might want to try:
extern "C"
{
#include "zlib.h"
};
and see if it might clean up any linkage errors.
niteice is offline   Reply With Quote
Old May 14th, 2006, 1:14 AM   #3
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
thanks niteice
Harakim is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:26 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC