c++ - 包含特定 boost header 时标准非 boost 文件中的错误

标签 c++ boost compiler-errors include

我正尝试在我正在执行的 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 ==========

最佳答案

@编码(marshal)克洛

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

不久之后,我实际上只将 curses.h 和 panel.h 包含在与程序入口点 Application.cpp 相同的文件中。我在很困的时候编了这个程序。

关于c++ - 包含特定 boost header 时标准非 boost 文件中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20182860/

相关文章:

c++ - 连接预处理器定义和字符串以创建#include 路径

c++ - 使用 boost 库工具/root 编译时出错

c++ - Mac OS X 10.7.4 和 FreeBSD 9.0 上没有右值引用

AngularJS错误: [$compile:nonassign]

c++ - 在另一个类中实现一个类的对象

c++ - 如何在 Eigen 中翻译矩阵(4x4)?

c++ - lock_guard 之后的 lock() 和 guard() 有什么区别

c++ - boost::shared_ptr - 两个类之间的组合关系

ruby - 需要 bigdecimal loaderror ruby

c++ - 不断收到错误 lnk2019