Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. LNK2019 for XmlLite

LNK2019 for XmlLite

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comxmlquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    A Ms
    wrote on last edited by
    #1

    Hi, I am using VS2008 SP1 On Widows 7 X64, once I have decided to use the XmlLite parser in my program I faced the following problem

    Error 1 error LNK2019: unresolved external symbol _CreateXmlReader@12 referenced in function
    "public: void __thiscall CXmlLiteSampleAppDlg::OnBnClickedButtonOpenXmlFile(void)"
    (?OnBnClickedButtonOpenXmlFile@CXmlLiteSampleAppDlg@@QAEXXZ) XmlLiteSampleAppDlg.obj

    and here is my code:

    void CXmlLiteSampleAppDlg::OnBnClickedButtonOpenXmlFile()
    {

    	CFileDialog fDlg(true,L"xml",NULL,
    		OFN\_PATHMUSTEXIST | OFN\_FILEMUSTEXIST | OFN\_EXPLORER,
    		L"XML Files (\*.xml)|\*.xml||",
    		this,NULL,true);
    	if(fDlg.DoModal()==IDOK){
    		CString fileName(fDlg.GetPathName());
    
    		::SHCreateStreamOnFileW(fileName,
    			STGM\_READWRITE | STGM\_SHARE\_DENY\_WRITE,&m\_pFileStream);
    
    		
    		HRESULT hr = ::CreateXmlReader(
    			\_\_uuidof(IXmlReader),reinterpret\_cast<void\*\*>(&m\_pXMLReader),NULL);
    
    		if(FAILED(hr)){
    			\_com\_error err(hr);
    			::AfxMessageBox(err.ErrorMessage());
    			return;
    		}
    
    	}//DoModal()
    

    }

    and my definitions of IStream and IXmlReader is like below:

    CComPtr <IStream> m_pFileStream;
    CComPt <IXmlReader> m_pXMLReader;

    Of course while surfing the net I find similar problem in this thread: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/fad815c9-0de3-4c97-a6a6-12d04a958013 and I have done all solution discussed there but non of them solve my problem. Also I have added

    $(WindowsSdkDir)\lib

    to the C++ Directories but this effort were in vain too.

    A 1 Reply Last reply
    0
    • A A Ms

      Hi, I am using VS2008 SP1 On Widows 7 X64, once I have decided to use the XmlLite parser in my program I faced the following problem

      Error 1 error LNK2019: unresolved external symbol _CreateXmlReader@12 referenced in function
      "public: void __thiscall CXmlLiteSampleAppDlg::OnBnClickedButtonOpenXmlFile(void)"
      (?OnBnClickedButtonOpenXmlFile@CXmlLiteSampleAppDlg@@QAEXXZ) XmlLiteSampleAppDlg.obj

      and here is my code:

      void CXmlLiteSampleAppDlg::OnBnClickedButtonOpenXmlFile()
      {

      	CFileDialog fDlg(true,L"xml",NULL,
      		OFN\_PATHMUSTEXIST | OFN\_FILEMUSTEXIST | OFN\_EXPLORER,
      		L"XML Files (\*.xml)|\*.xml||",
      		this,NULL,true);
      	if(fDlg.DoModal()==IDOK){
      		CString fileName(fDlg.GetPathName());
      
      		::SHCreateStreamOnFileW(fileName,
      			STGM\_READWRITE | STGM\_SHARE\_DENY\_WRITE,&m\_pFileStream);
      
      		
      		HRESULT hr = ::CreateXmlReader(
      			\_\_uuidof(IXmlReader),reinterpret\_cast<void\*\*>(&m\_pXMLReader),NULL);
      
      		if(FAILED(hr)){
      			\_com\_error err(hr);
      			::AfxMessageBox(err.ErrorMessage());
      			return;
      		}
      
      	}//DoModal()
      

      }

      and my definitions of IStream and IXmlReader is like below:

      CComPtr <IStream> m_pFileStream;
      CComPt <IXmlReader> m_pXMLReader;

      Of course while surfing the net I find similar problem in this thread: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/fad815c9-0de3-4c97-a6a6-12d04a958013 and I have done all solution discussed there but non of them solve my problem. Also I have added

      $(WindowsSdkDir)\lib

      to the C++ Directories but this effort were in vain too.

      A Offline
      A Offline
      A Ms
      wrote on last edited by
      #2

      Scott McPhillips solve my problem in msdn forums so I would put it here: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/719633c2-ff39-4c3d-84fd-2ca745524eab[^] and the answer: you have to add the xmllite.lib file to your project dependencies. 1.In the Solution Explorer, right click on the project and select Properties. 2.In the tree, expand Configuration Properties, and then expand Linker. 3.Under Linker, click on Input. Enter xmllite.lib for Additional Dependencies. 4.Click OK.

      C 1 Reply Last reply
      0
      • A A Ms

        Scott McPhillips solve my problem in msdn forums so I would put it here: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/719633c2-ff39-4c3d-84fd-2ca745524eab[^] and the answer: you have to add the xmllite.lib file to your project dependencies. 1.In the Solution Explorer, right click on the project and select Properties. 2.In the tree, expand Configuration Properties, and then expand Linker. 3.Under Linker, click on Input. Enter xmllite.lib for Additional Dependencies. 4.Click OK.

        C Offline
        C Offline
        conrad Braam
        wrote on last edited by
        #3

        The missing symbol the compiler was looking for was CreateXmlReader, I know the compiler indicated that the problem was in your dialog class, it's a common red herring, but once you know how to read these linker error messages, it gets easier :-) If adding a library path instead (if all you have is the .lib file), you will want to check that the library is added for debug and release builds. Configuring a project dependency as in the previous solution is thus best.

        Conrad - The world waits for you to stick your neck out, it's not easy. But once you actually stand up, you do get noticed. http://www.plcsimulator.org/

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups