0

I have never added a library to Dev-C++. I read the guide here.

So I added two lines of code to my cpp file:

#include "pugixml.hpp"
#include "pugiconfig.hpp"

But I get errors like this:

[Linker error] C:\Users\MATRIX~1\AppData\Local\Temp\ccYfRAuS.o:2.visualizza tutto.cpp:(.text+0xbc): undefined reference to `pugi::xml_document::xml_document()'

Can someone tell me how to do this in Dev-C++? I need to create a simple program that reads the XML that I created.

austin
  • 5,816
  • 2
  • 32
  • 40
newtphp
  • 245
  • 1
  • 4
  • 13
  • 1
    What's your problem? There's no difference between devc++ or any other c++ editor/ide/compiler with respect to include syntax. Have you forgotten #s? – Dmitry Ledentsov Dec 06 '13 at 15:28
  • @DmitryLedentsov It's a linker error, meaning that there's no problem with the syntax. Linking is done after the syntax check. It usually means you forgot to write the implementation of a function or misspelled its header, or your compiler doesn't know where the implementation is (in this case). – leewz Dec 06 '13 at 15:51

3 Answers3

0

You need to add the pugixml libraries. In Dev-C++ go to your project's linker settings and find the pugixml .lib files and add them.

austin
  • 5,816
  • 2
  • 32
  • 40
  • 1
    To expand: In general, with outside libraries, there are header files (declaring things) and there is object (not C++ objects) code (defining those things). Since the same header file can have different implementations, you have to point Dev-C++ to the compiled code. – leewz Dec 06 '13 at 15:48
  • There is no pugixml .lib in the pugixml zip file. I have .hpp and .cpp files – newtphp Dec 06 '13 at 17:32
  • You probably need to compile the library. Alternatively, you can try to find a pre-compiled version of it. – austin Dec 06 '13 at 17:42
  • Do you know where I can find even other precompiled library for xml parsing? I need to create an exe application ( DOS style graphic) which show the content of an xml file. Not the tags only the content and I need to add a description for the information in every tag. – newtphp Dec 06 '13 at 17:48
0

You don't need .lib file, you need to add pugixml.cpp to compilation. In Dev-C++ menu choose "Project" - > "Add To Project..." and choose pugixml.cpp.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
User8
  • 161
  • 6
0

Add the existing files' path to the include directory, then add the existing files to your project.

Then you will be able to reference them in #include and also in written code.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83