简体   繁体   English

无法在计算机上构建RAPIDXML库-错误消息

[英]Trouble building RAPIDXML library on a computer - error messages

I am working on a c++ project where I would like to use the rapidxml library. 我正在一个我想使用rapidxml库的c ++项目中。 The library can be found here: http://rapidxml.sourceforge.net/ I downloaded this (4 source code files .hpp) and was able to compile the project on my windows machine with the CodeBlocks IDE. 该库位于以下位置: http ://rapidxml.sourceforge.net/我下载了该库(4个源代码文件.hpp),并且能够使用CodeBlocks IDE在Windows机器上编译该项目。

However, when I attempted to build this on the linux machine at school, it showed the following error messages and would not compile successfully 但是,当我尝试在学校的linux计算机上构建它时,它显示以下错误消息,并且无法成功编译

I am not sure what the problem is and how I can avoid these errors/warnings. 我不确定是什么问题,以及如何避免这些错误/警告。

/mydirectory/rapidxml.hpp: In constructor 'rapidxml::parse_error::parse_error(const char*, void*)':
/mydirectory/rapidxml.hpp:78:13: error: declaration of 'where' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:78:13: error: declaration of 'what' shadows a member of 'this' [-Werror=shadow]
In file included from /mydirectory/VmapXmlParser.h:10:0,
                 from /projectFolder/VmapXmlParser.cpp:1:
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::name(const Ch*, std::size_t)':
/mydirectory/rapidxml.hpp:722:9: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::name(const Ch*)':
/mydirectory/rapidxml.hpp:731:9: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::value(const Ch*, std::size_t)':
/mydirectory/rapidxml.hpp:752:9: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::value(const Ch*)':
/mydirectory/rapidxml.hpp:761:9: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In constructor 'rapidxml::xml_node<Ch>::xml_node(rapidxml::node_type)':
/mydirectory/rapidxml.hpp:902:13: error: declaration of 'type' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_node<Ch>::type(rapidxml::node_type)':
/mydirectory/rapidxml.hpp:1066:9: error: declaration of 'type' shadows a member of 'this' [-Werror=shadow]
In file included from /mydirectory/VmapXmlParser.h:11:0,
                 from /projectFolder/VmapXmlParser.cpp:1:
/mydirectory/rapidxml_utils.hpp: In constructor 'rapidxml::file<Ch>::file(const char*)':
/mydirectory/rapidxml_utils.hpp:40:20: error: declaration of 'size' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml_utils.hpp: In constructor 'rapidxml::file<Ch>::file(const char*) [with Ch = char]':
/projectFolder/VmapXmlParser.cpp:29:46:   instantiated from here
/mydirectory/rapidxml_utils.hpp:40:40: error: declaration of 'size' shadows a member of 'this' [-Werror=shadow]
In file included from /mydirectory/VmapXmlParser.h:10:0,
                 from /projectFolder/VmapXmlParser.cpp:1:
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_node<Ch>::first_node(const Ch*, std::size_t, bool) const [with Ch = char, std::size_t = unsigned int]':
/projectFolder/VmapXmlParser.cpp:36:55:   instantiated from here
/mydirectory/rapidxml.hpp:936:23: error: declaration of 'name_size' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:936:23: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_node<Ch>::next_sibling(const Ch*, std::size_t, bool) const [with Ch = char, std::size_t = unsigned int]':
/projectFolder/VmapXmlParser.cpp:41:35:   instantiated from here
/mydirectory/rapidxml.hpp:1004:23: error: declaration of 'name_size' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:1004:23: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_attribute<Ch>* rapidxml::xml_node<Ch>::first_attribute(const Ch*, std::size_t, bool) const [with Ch = char, std::size_t = unsigned int]':
/projectFolder/VmapXmlParser.cpp:48:60:   instantiated from here
/mydirectory/rapidxml.hpp:1025:28: error: declaration of 'name_size' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:1025:28: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_attribute<Ch>* rapidxml::xml_attribute<Ch>::next_attribute(const Ch*, std::size_t, bool) const [with Ch = char, std::size_t = unsigned int]':
/projectFolder/VmapXmlParser.cpp:48:97:   instantiated from here
/mydirectory/rapidxml.hpp:856:28: error: declaration of 'name_size' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:856:28: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In constructor 'rapidxml::xml_node<Ch>::xml_node(rapidxml::node_type) [with Ch = char]':
/mydirectory/rapidxml.hpp:1365:41:   instantiated from 'rapidxml::xml_document<Ch>::xml_document() [with Ch = char]'
/projectFolder/VmapXmlParser.cpp:30:30:   instantiated from here
/mydirectory/rapidxml.hpp:901:9: error: declaration of 'type' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:2114:17: error: switch missing default case [-Werror=switch-default]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:2043:24: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_pi(Ch*&) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2107:48:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:1889:28: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:1899:29: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_comment(Ch*&) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2123:57:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:1790:25: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_cdata(Ch*&) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2134:55:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:2015:25: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_doctype(Ch*&) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2146:57:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:1817:25: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:1834:25: error: switch missing default case [-Werror=switch-default]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::name(const Ch*, std::size_t) [with Ch = char, std::size_t = unsigned int]':
/mydirectory/rapidxml.hpp:2047:13:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:721:14: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_document<Ch>::parse_node_attributes(Ch*&, rapidxml::xml_node<Ch>*) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2053:13:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:2243:28: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp:2053:13:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:2276:29: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::value(const Ch*, std::size_t) [with Ch = char, std::size_t = unsigned int]':
/mydirectory/rapidxml.hpp:1910:17:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_pi(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2107:48:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:751:14: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void* rapidxml::memory_pool<Ch>::allocate_aligned(std::size_t) [with Ch = char, std::size_t = unsigned int]':
/mydirectory/rapidxml.hpp:419:65:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::memory_pool<Ch>::allocate_node(rapidxml::node_type, const Ch*, const Ch*, std::size_t, std::size_t) [with Ch = char, std::size_t = unsigned int]'
/mydirectory/rapidxml.hpp:2040:69:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:618:69: error: cast from 'char*' to 'rapidxml::memory_pool<char>::header*' increases required alignment of target type [-Werror=cast-align]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::name(const Ch*) [with Ch = char]':
/mydirectory/rapidxml.hpp:426:21:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::memory_pool<Ch>::allocate_node(rapidxml::node_type, const Ch*, const Ch*, std::size_t, std::size_t) [with Ch = char, std::size_t = unsigned int]'
/mydirectory/rapidxml.hpp:2040:69:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:730:14: error: declaration of 'name' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'void rapidxml::xml_base<Ch>::value(const Ch*) [with Ch = char]':
/mydirectory/rapidxml.hpp:433:21:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::memory_pool<Ch>::allocate_node(rapidxml::node_type, const Ch*, const Ch*, std::size_t, std::size_t) [with Ch = char, std::size_t = unsigned int]'
/mydirectory/rapidxml.hpp:2040:69:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here
/mydirectory/rapidxml.hpp:760:14: error: declaration of 'value' shadows a member of 'this' [-Werror=shadow]
/mydirectory/rapidxml.hpp: In member function 'Ch rapidxml::xml_document<Ch>::parse_and_append_data(rapidxml::xml_node<Ch>*, Ch*&, Ch*) [with int Flags = 0, Ch = char]':
/mydirectory/rapidxml.hpp:2228:21:   instantiated from 'void rapidxml::xml_document<Ch>::parse_node_contents(Ch*&, rapidxml::xml_node<Ch>*) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2059:17:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_element(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:2090:49:   instantiated from 'rapidxml::xml_node<Ch>* rapidxml::xml_document<Ch>::parse_node(Ch*&) [with int Flags = 0, Ch = char]'
/mydirectory/rapidxml.hpp:1404:68:   instantiated from 'void rapidxml::xml_document<Ch>::parse(Ch*) [with int Flags = 0, Ch = char]'
/projectFolder/VmapXmlParser.cpp:31:32:   instantiated from here

You're using GCC with strict options which turn certain (or maybe all) warning messages into errors. 您正在使用带有严格选项的GCC,这些选项会将某些(或全部)警告消息变成错误。

Example - here's the errors:- 示例-这是错误:-

rapidxml.hpp: In constructor 'rapidxml::parse_error::parse_error(const char*, void*)':
rapidxml.hpp:78:13: error: declaration of 'where' shadows a member of 'this'
[-Werror=shadow]
rapidxml.hpp:78:13: error: declaration of 'what' shadows a member of 'this'
[-Werror=shadow]

... and here's the code ...这是代码

class parse_error: public std::exception
{
public:
    //! Constructs parse error
    parse_error(const char *what, void *where)
        : m_what(what)
        , m_where(where)
    {
    }

The 'problem' is that GCC thinks the code might be wrong because what and where are used as names of parameters in the constructor - but they're also defined as member functions of the base class. 问题是GCC认为代码可能是错误的,因为在构造函数中将whatwhat where用作参数的名称,但它们也被定义为基类的成员函数。 ( std::exception ). std::exception )。

This is perfectly valid C++ and will work just fine. 这是完全有效的C ++,可以正常工作。 GCC is just configured to be ultra-picky. GCC的配置非常挑剔。 You'll need to add the option -Wno-error=shadow to stop these warnings being treated as errors. 您需要添加选项-Wno-error=shadow以停止将这些警告视为错误。

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM