Group: http://groups.google.com/group/libharu/topics
- Problems moving to VS2010 [1 Update]
Topic: Problems moving to VS2010Bobby Reedy <Bobby...@infor.com> May 17 08:17AM -0400 ^
--
Good day,
Prior to now, I have used libHaru with Visual Studio 97 (VS5). We are moving everything to Visual Studio 2010. I am building static libs and they seem to build fine (zlib, libpng and libhpdf). However, I have the problem below when trying to link my application program. The deflate statements are part of zlib.
Has anyone using VS 2010 encountered this type of error? I have spent over a day trying to figure out what I thought was a simple link lib problem, but I have not been able to resolve. Likewise I do not know if the problem is in my application or one of the lib builds.
Any suggestions are greatly appreciated.
Thanks... Bobby Reedy
1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflateEnd referenced in function _HPDF_Stream_WriteToStreamWithDeflate
1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflate referenced in function _HPDF_Stream_WriteToStreamWithDeflate
1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflateInit_ referenced in function _HPDF_Stream_WriteToStreamWithDeflate
---
libHaru.org development mailing list
To unsubscribe, send email to libharu-u...@googlegroups.com
Thank you Karim for your suggestions. To restate the problem, the messages below came from the link step of my application program when trying to build static libs:
1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflateEnd referenced in function _HPDF_Stream_WriteToStreamWithDeflate
1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflate referenced in function _HPDF_Stream_WriteToStreamWithDeflate
1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflateInit_ referenced in function _HPDF_Stream_WriteToStreamWithDeflate
This problem of unresolved externals with deflate functions (which are zlib functions) seem to be pretty common when you search the internet. Most all of the time the issue was what you describe as well as other common link errors such as using the /MT option versus /MD option.
After too many days spent on this issue, I found the problem. I had to dig through the Haru and Zlib code to discover what was happening.
The issue was that I used the VS2010 SLN delivered in the zlib 1.2.5 (zlibvc.sln). Within it, there is a preprocessor option called ZLIB_WINAPI. While I do not know all the details, this evidently caused the functions to be built differently than what the function calls in libHaru use (std libraries vs win api libs I think).
Once I removed ZLIB_WINAPI from the zlib build and rebuilt my application program, the link step worked properly.
I find that the move from an old MS VS environment to VS2010 is a big one. On one hand, the new visual studio is loaded with enhancements, but there is a price to pay in terms of complexity. Things were much easier with simpler compile and link commands and make files.
We are also moving to updated compilers on several UNIX platforms. I have yet to do this but I hope the transition is less cumbersome than it has been with the windows development environments.
Again, thanks for your suggestions and the time you took to look at it.
Bobby Reedy