Tinyxml produces 50 compiler errors in my application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kiseitai2
    New Member
    • Jul 2007
    • 93

    Tinyxml produces 50 compiler errors in my application

    Hi,

    I'm in a Windows Vista machine and, when I try to compile my program's code, I get compiler errors that are not related to my app. I'm using Code::Blocks 10.05 with the MinGW (gcc) compiler set. The application I'm doing is a simple game engine (mostly for fun and learning). However, I'm using tinyxml to create a basic xml class so I can have externally generated data, such as texture locations, in my final engine. I don't know how to approach this problem. Thank you!


    Here's the log:

    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|55|error: syntax error before "TiXmlStrin g"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|56|error: syntax error before '{' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|62|error: syntax error before "npos"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|62|warning: data definition has no type or storage class|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|66|error: syntax error before ':' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|71|error: syntax error before '&' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|74|error: syntax error before '(' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|74|error: conflicting types for 'memcpy'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|74|error: conflicting types for 'memcpy'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|74|error: syntax error before '.' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|78|error: syntax error before ':' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|81|error: syntax error before '(' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|81|error: syntax error before ')' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|85|error: syntax error before "size_type" |
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|88|error: syntax error before '(' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|88|error: syntax error before ')' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h||In function `c_str':|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|128|error: syntax error before '{' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|197|error: syntax error before '&' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|215|error: syntax error before '}' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|217|error: syntax error before "sz"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|227|error: syntax error before "intsNeeded "|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|250|error: storage class specified for parameter `Rep'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|250|error: syntax error before "nullrep_"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|255|error: syntax error before "operator"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|92|error: parameter `TIXML_MAJOR_VE RSION' is initialized|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|93|error: parameter `TIXML_MINOR_VE RSION' is initialized|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|94|error: parameter `TIXML_PATCH_VE RSION' is initialized|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|101|error: syntax error before "TiXmlCurso r"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|101|warning: no semicolon at end of struct or union|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|106|error: syntax error before '}' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|159|warning: enum defined inside parms|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|159|warning: empty declaration|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|168|warning: enum defined inside parms|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|168|warning: empty declaration|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|170|error: syntax error before "TIXML_DEFAULT_ ENCODING"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|221|error: syntax error before "condense"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|221|error: storage class specified for parameter `SetCondenseWhi teSpace'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|262|error: syntax error before '&' token|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|262|error: storage class specified for parameter `EncodeString'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|284|warning: enum defined inside parms|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|284|warning: empty declaration|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|286|error: syntax error before "protected" |
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|290|error: storage class specified for parameter `bool'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|290|error: redefinition of parameter 'bool'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinystr .h|255|error: previous definition of 'bool' was here|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|290|error: syntax error before "IsWhiteSpa ce"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|316|error: syntax error before "TiXmlStrin g"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|320|error: storage class specified for parameter `ReadText'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|323|error: syntax error before "TiXmlEncoding" |
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|323|error: storage class specified for parameter `GetEntity'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|327|error: syntax error before "TiXmlEncoding" |
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|328|error: storage class specified for parameter `GetChar'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|371|error: storage class specified for parameter `errorString'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|373|error: syntax error before "TiXmlCurso r"|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|380|error: syntax error before "TiXmlEncoding" |
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|380|error: storage class specified for parameter `IsAlpha'|
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|381|error: syntax error before "TiXmlEncoding" |
    C:\Users\Kiseit ai2\Documents\D ev-Cpp Projects\Engine _Eureka\tinyxml .h|381|error: storage class specified for parameter `IsAlphaNum'|
    ||More errors follow but not being shown.|
    ||Edit the max errors limit in compiler options...|
    ||=== Build finished: 50 errors, 8 warnings ===|
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    In tinystr.h at line 55 the compiler got into trouble.

    The actual error is there or at some point earlier.

    Look around TiXmlString.

    Fix only the first error then rebuild. Often later errors are the result of previous errors and go away when the previous error is fixed.

    Comment

    • kiseitai2
      New Member
      • Jul 2007
      • 93

      #3
      Thanks! I'm gonna take a closer look around there. It concerns me , however, that I never changed any part of the original source code. I was expecting it to compile since I trust MinGW and the work of the tinyxml community. Thanks again!

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        It may be that tinystr.h needs you to include some other header before it is included. Or, it may be you need a build flag set.

        You could post the code around the tinystr.h include and then the first 55 lines of tinystr.h. We could take a peek

        Comment

        • kiseitai2
          New Member
          • Jul 2007
          • 93

          #5
          I took a look at the tinyxml code and it seems the problem has to do with a macro, which defines a type used in the code. Now, I'm terrible with macros. In fact, I only know how to recognize them, but I try to stay away from them. Here's the code snippet before line 55 that may be causing the syntax error:
          Code:
          #ifndef TIXML_USE_STL
          
          #ifndef TIXML_STRING_INCLUDED
          #define TIXML_STRING_INCLUDED
          
          #include <assert.h>
          #include <string.h>
          
          /*	The support for explicit isn't that universal, and it isn't really
          	required - it is used to check that the TiXmlString class isn't incorrectly
          	used. Be nice to old compilers and macro it here:
          */
          #if defined(_MSC_VER) && (_MSC_VER >= 1200 )
          	// Microsoft visual studio, version 6 and higher.
          	#define TIXML_EXPLICIT explicit
          #elif defined(__GNUC__) && (__GNUC__ >= 3 )
          	// GCC version 3 and higher.s
          	#define TIXML_EXPLICIT explicit
          #else
          	#define TIXML_EXPLICIT
          #endif
          I tried changing the elif part to if or else if and both gave errors. I also know that the source came with a Makefile and a Visual Studio solution file (.sln), so the Makefile may have any extra flags I am not aware. I will compare Code::Blocks's Makefile to tinyxml's and merge any flags tomorrow. Finally, I don't include tinystr.h into my code, but it is implemented by tinyxml.cpp/ tinyxml.h. Thanks and good night.

          Comment

          • kiseitai2
            New Member
            • Jul 2007
            • 93

            #6
            I solved the problem. I gotta face-palm for this. The issue was that, since I originally created the project as an empty project, the compiler used was defined by the source code's file extension. That is totally fine until you allow Code::Blocks to save your files with the C file extension (.c) instead of C++'s extension (.cpp). That was triggering the C compiler instead of the C++ compiler. Sorry for wasting your time.

            Comment

            Working...