简体   繁体   中英

Using libxml2 in Visual Studio 2008 and Windows XP

I have a weird problem when running an application that uses GNOME's libxml2 under Visual Studio 2008 (VS2008-SP1) and Windows XP.

I have two C++ projects:

  • Project A (a library)
  • Project B (an application that depends on Project A)

Both under one VS solution.

Project A is statically compiled with libxml2.lib. I've added dependencies to the library in both projects A and B .

Solution compiles perfectly. The only thing is, when I run it, I am getting the following error under Windows XP:

"This application has failed to start because libxml2.dll was not found. Re-installing the application may fix this problem".

I have tried this in two different Windows XP SP3 installations. And the weirdest thing is that it runs perfectly fine on Windows Vista, and I don't think it should be looking for DLL since it's statically compiled. Right?

Any ideas?

Assuming you've checked the obvious (is libxml2.dll present on the XP machines?) you might find Dependency Walker helpful - it will provide more detailed errors and logging than Windows will give you on its own.

Probably it's a dependency of libxml2 itself that's missing - Dependency Walker will tell you what that dependency is.

Considering that libxml2 is Gnome based project, I'm guessing it doesn't come by default on any Windows installation.

I'm betting the reason it works on Vista is that you have a different program installed on Vista which happens to include that library. Hence it works there by accident and not design.

I agree with Richie. The best way to tackle this problem is to get out DependencyWalker and see what dependency is failing on XP but not Vista. This will lead you to your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM