Menu

Compile errors, STL, Visual Studio 2005

2010-01-14
2013-05-20
  • Michael Brizic

    Michael Brizic - 2010-01-14

    I included the six recommended TinyXML header and cpp files in my project within Visual Studio 2005.  I am including the tinyxml.h header in my files where it is necessary.  I am using the STL and following the instruction of adding the #define TIXML_USE_STL line at the top of the tinyxml.h file.  However, I am still getting compile-time errors from tinyxml.cpp and notice that the TIXML_USE_STL macro does not appear highlighted as if it isn't getting defined somehow.  Here is a snippet of my compile-time errors:

    1>Compiling…
    1>Settings.cpp
    1>EntryComponent.cpp
    1>tinyxmlparser.cpp
    1>tinyxmlerror.cpp
    1>tinyxml.cpp
    1>.\External\tinyxml.cpp(41) : error C3861: 'fopen_s': identifier not found
    1>.\External\tinyxml.cpp(113) : error C2664: '_snprintf_s' : cannot convert parameter 3 from 'const char ' to 'size_t'
    1>        There is no context in which this conversion is possible
    1>.\External\tinyxml.cpp(686) : error C2664: '_snprintf_s' : cannot convert parameter 3 from 'const char ' to 'size_t'
    1>        There is no context in which this conversion is possible
    1>.\External\tinyxml.cpp(708) : error C2664: '_snprintf_s' : cannot convert parameter 3 from 'const char ' to 'size_t'
    1>        There is no context in which this conversion is possible
    1>.\External\tinyxml.cpp(1241) : error C3861: 'sscanf_s': identifier not found
    1>.\External\tinyxml.cpp(1248) : error C3861: 'sscanf_s': identifier not found
    1>.\External\tinyxml.cpp(1257) : error C2664: '_snprintf_s' : cannot convert parameter 3 from 'const char ' to 'size_t'
    1>        There is no context in which this conversion is possible
    1>.\External\tinyxml.cpp(1268) : error C2664: '_snprintf_s' : cannot convert parameter 3 from 'const char ' to 'size_t'
    1>        There is no context in which this conversion is possible
    1>tinystr.cpp

    I have combed through the forums and have not been able to locate a similar article/problem. 

    Can someone please help?

     
  • Michael Brizic

    Michael Brizic - 2010-01-14

    Actually, as I continue trying to solve this problem, I am beginning to wonder if it has anything at all to do with TIXML_USE_STL and may have more to do with #includes and/or other #defines.  I am still puzzled as to what I'm missing or doing wrong. 

    Would still appreciate anyone's thoughts/comments.

     
  • Michael Brizic

    Michael Brizic - 2010-01-14

    I think I may have solved the original compile-time errors I reported.  I discovered that in my project, there is a .vsprops file that had the following PreprocessorDefinition set: __STDC_WANT_SECURE_LIB__=0  This apparently was not letting the secure library to be included/compiled and available.  I changed the value from 0 to 1 and the errors are now gone.

    However, I believe my original problem still exists, namely, that I don't think I am compiling TinyXML with STL.  Again, I have tried adding the #define TIXML_USE_STL and even added it as a PrecompiledDefinition.  I do not see any compile errors in trying to use the TiXmlDocument constructor that accepts a string as argument, but I don't see any section where TIXML_USE_STL is referenced as highlighted as if it isn't being compiled.  Also, I notice that my application is compiling tinystr.cpp which I don't think it should if I'm compiling with STL.

    Would still like to hear back from someone on this subject.

     
  • YeenFei Lim

    YeenFei Lim - 2010-02-10

    have you tried defining TIXML_USE_STL in preprocessor section instead of the code?
    it might be your IDE messed up with the parsing priority

     
  • Michael Brizic

    Michael Brizic - 2010-02-21

    Yes, and it seems the problem is that the Visual Studio compiler is attempting to compile tinystr.cpp because I have it added to my project.  Once I remove that file from the project, it no longer compiles it.  Since I define TIXML_USE_STL as a preprocessor definition, my project doesn't require tinystr.cpp to compile.

    The confusion was over two things:
    1) when I saw compiler errors I was misled in believing that TIXML_USE_STL was not working because tinystr.cpp was being compiled and Visual Studio was not correctly highlighting the sections of code where #ifdef TIXML_USE_STL was present.
    2) yet the compiler errors seemed to be unrelated to TIXML_USE_STL (which they were, see above regarding .vsprops file).

     

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.