Thread: How to fix linker error LNK2019: unresolved external symbol and error LNK2001

  1. #1
    Registered User
    Join Date
    Feb 2016
    Posts
    1

    How to fix linker error LNK2019: unresolved external symbol and error LNK2001

    I am new to visual studio. I am going to study libxml2 library. So my first example is parsing a xml file. I follow libxml2 official tutorial. Libxml Tutorial I set the additional include directory path suitably. But there are build errors still remaining. my cpp file is in C. Code for Keyword Example
    help me.

    The output is as follows.


    1>------ Build started: Project: DemoLibxml, Configuration: Debug Win32 ------
    1>sample.obj : error LNK2019: unresolved external symbol _xmlStrcmp referenced in function "void __cdecl parseDoc(char *)" (?parseDoc@@YAXPAD@Z)
    1>sample.obj : error LNK2019: unresolved external symbol _xmlFreeDoc referenced in function "void __cdecl parseDoc(char *)" (?parseDoc@@YAXPAD@Z)
    1>sample.obj : error LNK2019: unresolved external symbol _xmlDocGetRootElement referenced in function "void __cdecl parseDoc(char *)" (?parseDoc@@YAXPAD@Z)
    1>sample.obj : error LNK2019: unresolved external symbol _xmlNodeListGetString referenced in function "void __cdecl parseStory(struct _xmlDoc *,struct _xmlNode *)" (?parseStory@@YAXPAU_xmlDoc@@PAU_xmlNode@@@Z)
    1>sample.obj : error LNK2019: unresolved external symbol _xmlParseFile referenced in function "void __cdecl parseDoc(char *)" (?parseDoc@@YAXPAD@Z)
    1>sample.obj : error LNK2001: unresolved external symbol __imp__xmlFree
    1>D:\cppwork\DemoLibxml\Debug\DemoLibxml.exe : fatal error LNK1120: 6 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Libxml is a C language library. It probably wasn't originally engineered to be compatible with C++ and its link stage. Fortunately, since libxml is a popular library, you can download a C++ binding. One popular one is libxml++

  3. #3
    Guest
    Guest
    I can also recommend PugiXML.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error LNK2001: unresolved external symbol
    By kandas.soft in forum C++ Programming
    Replies: 4
    Last Post: 07-02-2011, 06:51 AM
  2. Replies: 3
    Last Post: 10-02-2007, 09:12 PM
  3. error LNK2001: unresolved external symbol
    By matth in forum C++ Programming
    Replies: 1
    Last Post: 01-19-2006, 04:42 PM
  4. error LNK2001: unresolved external symbol
    By Unregistered in forum C Programming
    Replies: 12
    Last Post: 07-12-2002, 08:45 PM

Tags for this Thread