【发布时间】:2013-11-25 00:16:34
【问题描述】:
我正在尝试在我正在做的 C++ 项目中为我的实体实现 UUID。我正在使用 Visual Studio Professional 2012。
我能够包含并且没有任何错误,但我也希望 uuid_io.hpp 能够将 UUID 转换为字符串或将其输出到标准输出,但只要我包含它,我就会得到很多错误,似乎与任何 boost 文件无关。
我正在使用来自 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 ==========
【问题讨论】:
-
我建议删除包含文件,直到找到导致问题的文件,然后查看该文件。但是,如果我不得不猜测,我会说有人正在定义一个名为“clear”的宏,这会导致问题。
-
更多证据:boost/io/ios_state.hpp 第 121 行包含对
{ s.clear(a); }的调用,其中s是传递给例程的参数。错误消息“宏 'clear' 的实际参数过多”看起来更能说明问题。 -
罪魁祸首确实是用这种方法确定的。 curses.h 和 panel.h 头文件放在 boost 头文件之前会导致问题,将它们移到 Common.h 文件中的最后一个允许程序编译没有错误,谢谢! :)
标签: c++ boost compiler-errors include