Menu

Doc.Open only working in Release mode

2007-06-27
2013-05-20
  • JPendergrass

    JPendergrass - 2007-06-27

    When I use:
    doc.LoadFile("userPrefs.xml");
    in the loadfile function I step through it and see the error is occuring in:

        TIXML_STRING filename( _filename );
        value = filename;

        // reading in binary mode so that tinyxml can normalize the EOL
        FILE* file = TiXmlFOpen( value.c_str(), "rb" );   

    in value _bx _buf is set correctly but _ptr is bad Pointer. I think this is what's causing it. However when I run it in release mode everything is fine...
    Any suggestions?

     
    • Ellers

      Ellers - 2007-06-27

      Can you post the XML, what OS and compiler, what version of TinyXML, and what exactly is the error?

       
    • JPendergrass

      JPendergrass - 2007-06-27

      userPrefs.xml:
      <?xml version="1.0" standalone="no" ?>
      <!-- Video Options -->
      <VideoOptions>
          <Video resolusion="800 x 600" colourDepth="32" syncBufferSwamp="false" depthBuffer="false" NVPrefHud="false" FSAA="0" displayFrequency="60" fullScreen="false" />
      </VideoOptions>

      OS: Windows XP
      Compiler: VS8, using VC++

      Tiny XML version: 2.5.3

      doc.Error() gets description: Failed to open file

       
      • Ellers

        Ellers - 2007-06-27

        Weird. It works for me just fine in debug and release:

        FILE * f=fopen("userPrefs.xml", "rb");
        TiXmlDocument xml("userPrefs.xml");
        bool b=xml.LoadFile(f);
        fclose(f);
        assert(b==true);

        (XP / Studio 7 / tinyxml version 2.51)

        If you try the above does it help at all? (Not much of a solution but as a start...)

        Ellers

         
    • JPendergrass

      JPendergrass - 2007-06-27

      Copy / Pasted code and recieving the same error. Works in release but not debug.

      Thanks for the try though.

       
    • Ellers

      Ellers - 2007-06-27

      Odd. It works fine for me but not for you.
      Notable obvious differences are different versions of IDE/compiler and TinyXml.
      But I don't really think thats the problem.

      If you create a brand new, clean, simple project and make it only load the file does it work?
      I'm suspicious of some weird issue like another library (e.g. linked only in debug mode) or odd compiler setting being used.

      ?
      Ellers

       
    • JPendergrass

      JPendergrass - 2007-06-27

      Actually by its self your code works in debug.

      I just went through and added all the libraries, dependencies to the new project and it seemed to work still:

      Definitions:
      WIN32;_DEBUG;_WINDOWS;TIXML_USE_STL

      Dependencies
      OgreMain_d.lib
      OIS_d.lib
      CEGUIBase_d.lib
      OgreGUIRenderer_d.lib

      Directories match in both projects

      So this may not be a TinyXML issue...

       
      • Ellers

        Ellers - 2007-06-27

        Thats progress at least.

        I doubt its a TinyXml issue because, well, you're only loading a file, and thats fairly well tested and used in many projects ;)

        Just linking the other libs may not be enough - the compiler probably only links symbols that are referenced in the program.

        I guess - for want of better advice - continue adding in parts of the real program until it breaks.

        HTH
        Ellers

         
    • JPendergrass

      JPendergrass - 2007-06-28

      Found the problem..
      You were right was conflict..
      Ogre was pointing Debug working directory to: $(OGRE_HOME)\Bin\$(ConfigurationName)
      Simple removed that and works perfect.

      Thanks for pointing me in the right direction much Appriciated!!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.