包含特定boost标头时标准非boost文件中的错误

时间:2013-11-25 00:16:34

标签: c++ boost compiler-errors include

我试图在我正在做的C ++项目中为我的实体实现UUID。我使用的是Visual Studio Professional 2012。

我能够包含并解决任何错误,但我也希望uuid_io.hpp能够将UUID转换为字符串或只是将其输出到stdout,但是只要我将其包含在内,我就会得到它很多错误,似乎与任何提升文件无关。

我使用来自here.的msvc11的32位Windows二进制文件

我有一个常见的包含文件,如下所示:

//Common.h
#ifndef COMMON_H
#define COMMON_H

#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <map>

#include <curses.h>
#include <panel.h>

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>

#include "Map.h"
#include "Tile.h"
#include "Grid.h"
#include "Entity.h"

#endif

(curses.h和panel.h来自pdcurses项目,从here.下载)

这是我得到的输出:

1>------ Build started: Project: Curses, Configuration: Debug Win32 ------
1>  Map.cpp
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\algorithm(35): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocbuf(273): warning C4002: too many actual parameters for macro 'erase'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocbuf(283): warning C4002: too many actual parameters for macro 'erase'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(121): warning C4002: too many actual parameters for macro 'clear'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(126): warning C4002: too many actual parameters for macro 'clear'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(382): warning C4002: too many actual parameters for macro 'clear'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(557): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(603): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(610): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(617): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(642): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1331): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1494): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1521): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\functional(239): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(494): error C2059: syntax error : '('
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(464) : while compiling class template member function 'std::string std::money_get<_Elem,_InIt>::_Getmfld(_InIt &,_InIt &,bool,std::ios_base &,_Elem *) const'
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(415) : see reference to function template instantiation 'std::string std::money_get<_Elem,_InIt>::_Getmfld(_InIt &,_InIt &,bool,std::ios_base &,_Elem *) const' being compiled
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(950) : see reference to class template instantiation 'std::money_get<_Elem,_InIt>' being compiled
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(495): error C2039: '_Off' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(495): error C2039: '_Sign' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(497): error C2059: syntax error : '('
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2039: '_Source' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2039: '_Symbol' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2668: 'std::basic_string<_Elem,_Traits,_Alloc>::begin' : ambiguous call to overloaded function
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xstring(1578): could be 'std::_String_const_iterator<_Mystr> std::basic_string<_Elem,_Traits,_Alloc>::begin(void) throw() const'
1>          with
1>          [
1>              _Mystr=std::_String_val<std::_Simple_types<char>>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xstring(1573): or       'std::_String_iterator<_Mystr> std::basic_string<_Elem,_Traits,_Alloc>::begin(void) throw()'
1>          with
1>          [
1>              _Mystr=std::_String_val<std::_Simple_types<char>>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          while trying to match the argument list '(void)'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(636): error C2059: syntax error : '('
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(637): error C2039: '_Neg' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(638): error C2039: '_Val' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>  Entity.cpp
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\algorithm(35): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocbuf(273): warning C4002: too many actual parameters for macro 'erase'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocbuf(283): warning C4002: too many actual parameters for macro 'erase'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(121): warning C4002: too many actual parameters for macro 'clear'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(126): warning C4002: too many actual parameters for macro 'clear'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(382): warning C4002: too many actual parameters for macro 'clear'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(557): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(603): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(610): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(617): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(642): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1331): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1494): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1521): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\functional(239): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(494): error C2059: syntax error : '('
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(464) : while compiling class template member function 'std::string std::money_get<_Elem,_InIt>::_Getmfld(_InIt &,_InIt &,bool,std::ios_base &,_Elem *) const'
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(415) : see reference to function template instantiation 'std::string std::money_get<_Elem,_InIt>::_Getmfld(_InIt &,_InIt &,bool,std::ios_base &,_Elem *) const' being compiled
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(950) : see reference to class template instantiation 'std::money_get<_Elem,_InIt>' being compiled
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(495): error C2039: '_Off' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(495): error C2039: '_Sign' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(497): error C2059: syntax error : '('
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2039: '_Source' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2039: '_Symbol' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2668: 'std::basic_string<_Elem,_Traits,_Alloc>::begin' : ambiguous call to overloaded function
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xstring(1578): could be 'std::_String_const_iterator<_Mystr> std::basic_string<_Elem,_Traits,_Alloc>::begin(void) throw() const'
1>          with
1>          [
1>              _Mystr=std::_String_val<std::_Simple_types<char>>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xstring(1573): or       'std::_String_iterator<_Mystr> std::basic_string<_Elem,_Traits,_Alloc>::begin(void) throw()'
1>          with
1>          [
1>              _Mystr=std::_String_val<std::_Simple_types<char>>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          while trying to match the argument list '(void)'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(636): error C2059: syntax error : '('
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(637): error C2039: '_Neg' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(638): error C2039: '_Val' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>  Application.cpp
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\algorithm(35): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocbuf(273): warning C4002: too many actual parameters for macro 'erase'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocbuf(283): warning C4002: too many actual parameters for macro 'erase'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(121): warning C4002: too many actual parameters for macro 'clear'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(126): warning C4002: too many actual parameters for macro 'clear'
1>e:\lib\boost_1_55_0\boost\io\ios_state.hpp(382): warning C4002: too many actual parameters for macro 'clear'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(557): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(603): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(610): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(617): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(642): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1331): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1494): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\memory(1521): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\functional(239): warning C4003: not enough actual parameters for macro 'move'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(494): error C2059: syntax error : '('
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(464) : while compiling class template member function 'std::string std::money_get<_Elem,_InIt>::_Getmfld(_InIt &,_InIt &,bool,std::ios_base &,_Elem *) const'
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(415) : see reference to function template instantiation 'std::string std::money_get<_Elem,_InIt>::_Getmfld(_InIt &,_InIt &,bool,std::ios_base &,_Elem *) const' being compiled
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(950) : see reference to class template instantiation 'std::money_get<_Elem,_InIt>' being compiled
1>          with
1>          [
1>              _Elem=char,
1>              _InIt=std::istreambuf_iterator<char,std::char_traits<char>>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(495): error C2039: '_Off' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(495): error C2039: '_Sign' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(497): error C2059: syntax error : '('
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2039: '_Source' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2039: '_Symbol' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(499): error C2668: 'std::basic_string<_Elem,_Traits,_Alloc>::begin' : ambiguous call to overloaded function
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xstring(1578): could be 'std::_String_const_iterator<_Mystr> std::basic_string<_Elem,_Traits,_Alloc>::begin(void) throw() const'
1>          with
1>          [
1>              _Mystr=std::_String_val<std::_Simple_types<char>>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          d:\program (x86)\microsoft visual studio 11.0\vc\include\xstring(1573): or       'std::_String_iterator<_Mystr> std::basic_string<_Elem,_Traits,_Alloc>::begin(void) throw()'
1>          with
1>          [
1>              _Mystr=std::_String_val<std::_Simple_types<char>>,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          while trying to match the argument list '(void)'
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(636): error C2059: syntax error : '('
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(637): error C2039: '_Neg' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>d:\program (x86)\microsoft visual studio 11.0\vc\include\xlocmon(638): error C2039: '_Val' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

1 个答案:

答案 0 :(得分:1)

@Marshall Clow

罪魁祸首确实是由这种方法决定的。 curses.h和panel.h头文件放在boost头之前引起了问题,将它们移到Common.h文件中的最后一个允许程序编译没有错误,谢谢! :)

过了一会儿,我实际上最终只是将curses.h和panel.h包含在与程序入口点Application.cpp相同的文件中。当我很困的时候,我编程了这个。