Search code examples
wxwidgetsmingwcodeblockslibxml2

code::blocks, libxml2 / libxml/parser.h: No such file or directory


Hello I'm trying to write some tool using code::blocks, wxWidgets and libxml2 on Windows platform.

Things I've done:

  1. copied libxml2.a, libxml2.dll.a and other libs to MinGW lib/ folder
  2. Wrote some headers like this in my source file:

    #include <libxml/xmlmemory.h>
    #include <libxml/parser.h>
    
  3. Added -lxml2 to linker

And now, when I'm trying to build this project I'm getting this error:

error: libxml/xmlmemory.h: No such file or directory

Anyone here experienced this error? I believe that I misconfigured something but don't really know what. Thanks for your ideas.


Solution

  • In general, it's better to not move things into the mingw directories, but to leave them in their own directories, and add search paths to the project properties so it knows where to look for them.

    If you go into your project properties in Code::Blocks, hit the Project build options button, then inside the Linker Settings tab, add the two libraries you're linking against. Then In the Search directories tab, add the /include to compiler search locations, and optionally, add the /lib directory to Linker locations (This isn't necessary if you gave the full path to the .a in the linker settings.