C++ 不能包括<;charconv>;在我的mfc应用程序中,编译器错误

C++ 不能包括<;charconv>;在我的mfc应用程序中,编译器错误,c++,mfc,c++17,C++,Mfc,C++17,不久前,我将我的MFC应用程序移到了C++17,一切都很好。我想使用cpp文件中包含的std::to_chars。没用。尝试将其早期放入StdAfx.h,出现相同的错误 然后我用一个控制台应用程序进行了尝试,即使我在MFC应用程序中添加了大量的头文件,我也没有发现错误。这些错误是某种头文件包含冲突,它们只是在编译StdAfx.h时出现的。即使我将其作为StdAfx.h中的第一个文件,也会发生这种情况。我已经在两个项目的属性之间进行了切换,它们在所有实际用途上都是相同的 更新 我正在使用: SDK

不久前,我将我的MFC应用程序移到了C++17,一切都很好。我想使用cpp文件中包含的
std::to_chars
。没用。尝试将其早期放入StdAfx.h,出现相同的错误

然后我用一个控制台应用程序进行了尝试,即使我在MFC应用程序中添加了大量的头文件,我也没有发现错误。这些错误是某种头文件包含冲突,它们只是在编译StdAfx.h时出现的。即使我将其作为StdAfx.h中的第一个文件,也会发生这种情况。我已经在两个项目的属性之间进行了切换,它们在所有实际用途上都是相同的

更新

我正在使用: SDK 10.0(最新安装版本) Visual Studio 2019(v142) 版本16.4.2 ISO C++17标准(标准:C++17)


在控制台应用程序中,我尝试了使用和不使用预编译的头文件,并且它可以双向工作。 我已经发布了一个cpp文件中包含的完整错误消息

我想知道我的项目文件中是否隐藏着什么东西。它已经20岁了,现在是从VS6长大的。现在我只使用
autostr(std::to_wstring(cur))我的下一步是创建一个干净的项目,并将我的应用程序源代码复制到该项目。不管怎样,我都需要尝试一下,因为它可能会修复,我仍然不能用向导添加变量

编译
时出错:

\charconv(1503,68):错误C2672:'std::_Max_value':未找到匹配的重载函数
\charconv(1912):消息:请参阅正在编译的函数模板实例化“std::errc std::_Convert_decimal_string_to_floating_type(const std::_floating_point_string&,_FloatingType&,bool)noexcept”的参考
1> 与
1>        [
1> _浮动=浮动,
1> \u FloatingType=浮动
1>        ]
\charconv(2053):消息:请参阅正在编译的函数模板实例化“std::from_chars_result std::_普通_floating_from_chars(const char*const,const char*const,_floating&,const std::chars_format,const bool,const char*)noexcept”
1> 与
1>        [
1> _浮动=浮动
1>        ]
\charconv(2065):消息:请参阅正在编译的函数模板实例化“std::from_chars_result std::_Floating_from_chars(const char*const,const char*const,_Floating&,const std::chars_format)noexcept”
1> 与
1>        [
1> _浮动=浮动
1>        ]
\charconv(1503,1):错误C2782:'const_Ty&std::_Max_value(const_Ty&,const_Ty&)noexcept()':模板参数'\u Ty'不明确
\实用程序(35):消息:请参阅“std::_Max_value”的声明
\charconv(1503,1):消息:可能是“int32\t”
\charconv(1503,1):消息:或“int”
\charconv(1503,1):错误C2784:'const\u Ty&std::_Max\u value(const\u Ty&,const\u Ty&)noexcept()':无法从'const int32\t'推断'const\u Ty&'的模板参数
\实用程序(35):消息:请参阅“std::_Max_value”的声明
\charconv(1503,44):错误C2789:“_正指数”:必须初始化常量限定类型的对象
\charconv(1503):消息:参见“\u正指数”的声明
我在未创建问题的情况下添加到console应用程序的标题:

#include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/locale.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/spirit/home/x3.hpp>
#include <SDKDDKVer.h>
#include <intsafe.h>
#include <afxwin.h>         // MFC core and standard components
#include <charconv>
#include <afxrich.h>        // MFC Rich Edit Control used in most.
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdb.h>          // ODBC support
#include <afxdtctl.h>       // MFC support for Internet Explorer 4 Common Controls
#include <afxcmn.h>         // MFC support for Windows Common Controls
#include <afxcview.h>       // MFC Common controls
#include <afxdhtml.h>       // html support
#include <afxdlgs.h>        // Common Dialogs
#include <afxtempl.h>       // MFC template support.
#include <atlimage.h>       // GDIPlus, not....
#include <raserror.h>       // ERROR_ defines
#include <direct.h>         // for _tchdir( GetProjectDirectory( ) );
#include <shlobj.h>         // SHGetFolderPath(...)
#include <afxdialogex.h>    //for ReTreeDlg
#include <gdiplus.h>        // GDIPlus
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <boost/asio/connect.hpp>
#include <boost/bind.hpp>
#include <boost/exception/exception.hpp>
#include <boost/thread.hpp>
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>
#包括
#包括
#包括
#包括
#包括
#包括
#包括//MFC核心和标准组件
#包括
#包含//大多数应用程序中使用的MFC丰富的编辑控件。
#包括//MFC扩展
#包括//MFC自动化类
#包括//ODBC支持
#包括//对Internet Explorer 4通用控件的MFC支持
#包括//对Windows通用控件的MFC支持
#包括//MFC通用控件
#包括//html支持
#包含//常用对话框
#包括//MFC模板支持。
#包括//GDIPlus,而不是。。。。
#包含//错误定义
#包括//for_tchdir(GetProjectDirectory());
#包括//SHGetFolderPath(…)
#包括//用于重新调整
#包括//GDIPlus
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括

十有八九我会在写问题的时候弄清楚。这只是一次,我不知所措。只是希望有人以前见过这种情况。

这完全是我干的。事实证明,在我的一个附加include路径中,我有一个旧的
stdint.h
。编译器会在SDK中找到较新的一个之前选择它。在我尝试合并
charconv
之前,一切正常。它的日期是2012年,我把它放在那里作为搬到VS2010的一部分


因此,教训是,如果有这样一个奇怪的冲突,一定要检查你是否做了一些愚蠢的事情,比如在你自己的包含中放了一个不应该放在那里的文件。这样做可能会在今天修复某些问题,但可能会在几年后破坏某些问题。

您使用的是哪种Visual Studio版本,您使用的是哪种标准进行编译?如果您在构建时不使用预编译的头文件,它会起作用吗?也就是说,在任何地方都不要使用
StdAfx.h
。在控制台应用程序中,我尝试了使用和不使用预编译头的方法,效果良好。我正在使用最新的VS2019最新
10
sdk,当然还有c++17作为语言。我是一个落后的更新,我会拿下,但我怀疑它会改变这一点。我想在正文中更新,但现在谷歌不允许我使用firefox登录……请显示完整的错误消息。对于模板,理解编译器试图做什么很重要。截断的错误消息只显示编译器最终放弃的位置。为了可读性,你可以去掉公共路径前缀。嗨@Andrew Truckle在过去的几周里,我把我的项目改为unicode。我从一个新的空项目开始,并复制了文件。现在向导开始工作了。我能看到的区别是在旧项目中
,但在新项目中不存在。我不得不添加韩寒的其他资源
#include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/locale.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/spirit/home/x3.hpp>
#include <SDKDDKVer.h>
#include <intsafe.h>
#include <afxwin.h>         // MFC core and standard components
#include <charconv>
#include <afxrich.h>        // MFC Rich Edit Control used in most.
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdb.h>          // ODBC support
#include <afxdtctl.h>       // MFC support for Internet Explorer 4 Common Controls
#include <afxcmn.h>         // MFC support for Windows Common Controls
#include <afxcview.h>       // MFC Common controls
#include <afxdhtml.h>       // html support
#include <afxdlgs.h>        // Common Dialogs
#include <afxtempl.h>       // MFC template support.
#include <atlimage.h>       // GDIPlus, not....
#include <raserror.h>       // ERROR_ defines
#include <direct.h>         // for _tchdir( GetProjectDirectory( ) );
#include <shlobj.h>         // SHGetFolderPath(...)
#include <afxdialogex.h>    //for ReTreeDlg
#include <gdiplus.h>        // GDIPlus
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <boost/asio/connect.hpp>
#include <boost/bind.hpp>
#include <boost/exception/exception.hpp>
#include <boost/thread.hpp>
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>