qt error C2664: “QString::QString(const QChar *,int)”: 无法将参数 1 从“_Ty”转换为“const QChar *”
error C2664: “QString::QString(const QChar *,int)”: 无法将参数 1 从“_Ty”转换为“const QChar *”
双击代码跳转:脱离了用户代码
编译报错位置, static _CONSTEXPR20_DYNALLOC void construct(_Alloc&, _Objty* const _Ptr, _Types&&... _Args) { #ifdef __cpp_lib_constexpr_dynamic_alloc if (_STD is_constant_evaluated()) { _STD construct_at(_Ptr, _STD forward<_Types>(_Args)...); } else #endif // __cpp_lib_constexpr_dynamic_alloc { ::new (_Voidify_iter(_Ptr)) _Objty(_STD forward<_Types>(_Args)...); } }
Visual Studio 的“错误列表”窗口通常只显示错误的最终结果,信息被截断了。 :
- 点击菜单栏的 “视图” -> “输出”(或按快捷键
Ctrl + Alt + O)。 - 在下拉框中选择 “生成”。
- 向上滚动:在输出窗口中,找到
error C2664这一行,然后一直往上翻。你会看到类似note: 参见对正在编译的函数模板实例化...或note: 参见对正在编译的类模板实例化...的提示。这些note会一层一层地剥开模板,最终指向你代码中具体调用QString或std::vector的那一行。
1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xmemory(714,47): error C2664: “QString::QString(const QChar *,int)”: 无法将参数 1 从“_Ty”转换为“const QChar *” 1> with 1> [ 1> _Ty=std::vector<QString,std::allocator<QString>> 1> ] 1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xmemory(714,68): message : 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符 1>D:\Qt5.15.2\5.15.2\msvc2019_64\include\QtCore\qstring.h(264,5): message : 参见“QString::QString”的声明 1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vector(721): message : 查看对正在编译的函数 模板 实例化“void std::_Default_allocator_traits<_Alloc>::construct<_Ty,std::vector<_Ty,_Alloc>&>(_Alloc &,_Objty *const ,std::vector<_Ty,_Alloc> &)”的引用 1> with 1> [ 1> _Alloc=std::allocator<QString>, 1> _Ty=QString, 1> _Objty=QString 1> ] 1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vector(726): message : 查看对正在编译的函数 模板 实例化“void std::_Default_allocator_traits<_Alloc>::construct<_Ty,std::vector<_Ty,_Alloc>&>(_Alloc &,_Objty *const ,std::vector<_Ty,_Alloc> &)”的引用 1> with 1> [ 1> _Alloc=std::allocator<QString>, 1> _Ty=QString, 1> _Objty=QString 1> ] 1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vector(739): message : 查看对正在编译的函数 模板 实例化“void std::vector<QString,std::allocator<T>>::_Emplace_back_with_unused_capacity<_Ty&>(_Ty &)”的引用 1> with 1> [ 1> T=QString, 1> _Ty=std::vector<QString,std::allocator<QString>> 1> ] 1>D:\Qxxxx_xxxvs\SugarTvision_ReleaseX64TensorRT\SugarTvision\FormDataGeneration.cpp(1451): message : 查看对正在编译的函数 模板 实例化“void std::vector<QString,std::allocator<T>>::emplace_back<_Ty&>(_Ty &)”的引用 1> with 1> [ 1> T=QString, 1> _Ty=std::vector<QString,std::allocator<QString>> 1> ]
问题在
FormDataGeneration.cpp(1451)位置
欢迎讨论,相互学习。
cdtxw@foxmail.com

浙公网安备 33010602011771号