[xml] Linking to dll version of libxml2, et al. with VS 2008



   I tried searching the list Archive, but didn’t find what looked like recent answers to this question, and they all seemed to differ a bit in the details. So, please forgive me if this is a FAQ, but I was unsuccessful in searching for the answer.


   Anyhow, I have a Visual Studio project in which I want to use libxml2 to parse some xml files. I downloaded the Windows binaries for libxml2, iconv, and zlib.


   In my Visual Studio project’s properties sheet, in the “Linker” section, in the “Additional Library Directories” option I added the “lib” sub-directories under each of the libraries’ own directories


(e.g "..\libxml2-2.7.7.win32\lib" for the libxml2 library, and similar for iconv and zlib).


Additionally, in the “Input>Additional Dependencies” option, I added libxml2_a_dll.lib iconv.lib zdll.lib, so that the linker would use those to resolve symbols.


However, I am getting a bunch of linker errors when building my projects, similar to the following examples:


error LNK2019: unresolved external symbol __imp__WSAGetLastError 0 referenced in function _socket_errno                libxml2_a_dll.lib

error LNK2019: unresolved external symbol __imp__closesocket 4 referenced in function _xmlNanoHTTPFreeCtxt                libxml2_a_dll.lib


Additionally, I’m getting a warning (which might be related?):


warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library


Any help you can provide in resolving these would be greatly appreciated. It looks to me like WSAGetLastError, closesocket, etc., might be Windows System API’s that *should* be resolved from the MSVCRT libraries?


If I try to build the project with the “Ignore Default Libraries” option set to “YES”, then the linker can’t resolve the calls to standard c library functions I make in my program, such as calling printf, malloc, realloc, free, qsort, etc.


Jeff Schmidt

QA Analyst


Seapine Software, Inc. | Be Quality Ready

5412 Courseview Dr., Suite 200, Mason, OH 45040

Phone: 513.701.1551 | Fax: 513.754.1660



Join Seapine's Agile Expedition. Learn more @ www.seapine.com/AgileExpedition


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]