View Single Post
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