简体   繁体   English

错误C2146:语法错误:在按功能传递地图时,在标识符mType之前缺少','

[英]error C2146: syntax error : missing ',' before identifier mType when passing a map by function

When I declare the below function: 当我声明以下功能时:

#include <vector>
#include <map>
void setTypeByBanknote(tsBanknotes &tsBanknotes, std::map<char, std::vector<byte>> &mType);

My compiler shows the following error: 我的编译器显示以下错误:

error C2146: syntax error : missing ',' before identifier mType 错误C2146:语法错误:在标识符mType之前缺少','

But if I do the following: 但如果我做以下事情:

#include <vector>
#include <map>
typedef std::vector<byte> tvByteVector;
void setTypeByBanknote(tsBanknotes &tsBanknotes, std::map<char, tvByteVector &mType);

My compiler does not show any error and compiles correctly 我的编译器没有显示任何错误并正确编译

Is there any way to pass this map as an argument without using typedef ? 有没有办法在不使用typedef的情况下将此映射作为参数传递?

I'm using visual 6.0 as IDE , I know it is very old. 我使用visual 6.0 as IDE ,我知道它已经很老了。 Is the problem because of the old IDE ? 问题是因为旧的IDE? I do include vector and map libraries. 我包括矢量和地图库。

Thanks in advance! 提前致谢!

std::map<char, std::vector<byte> >
                               ^^^^

You need a space between two > s like > > . 您需要两个之间的空间>就像> > Otherwise VS 6.0, which is very old, gets confused with operator >> . 否则VS 6.0,这是非常老的,与运营商>>混淆。 It's better to update the compiler. 最好更新编译器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误C2146:语法错误:缺少&#39;;&#39; 在标识符之前 - error C2146: syntax error : missing ';' before identifier 错误C2146:语法错误:在标识符&#39;A1&#39;之前缺少&#39;,&#39; - Error C2146: syntax error : missing ',' before identifier 'A1' 错误C2146:语法错误:缺少&#39;;&#39; 在标识符之前 - Error C2146: syntax error : missing ';' before identifier 错误C2146:语法错误:缺少&#39;;&#39; 在标识符&#39;ContextRecord&#39;之前 - error C2146: syntax error : missing ';' before identifier 'ContextRecord' 模板Fn指针错误C2146:语法错误:缺少&#39;;&#39; 在标识符之前 - Template Fn Pointer error C2146: syntax error : missing ';' before identifier 错误C2146:语法错误:缺少&#39;;&#39; 在标识符&#39;m_ball&#39;C ++之前 - error C2146: syntax error : missing ';' before identifier 'm_ball' C++, MFC C ++错误1错误C2146:语法错误:缺少&#39;;&#39; 在标识符“记录”之前 - C++ Error 1 error C2146: syntax error: missing ';' before identifier 'records' VC ++错误C2146:语法错误:标识符&#39;pFirst&#39;之前缺少&#39;)&#39; - VC++ error C2146: syntax error : missing ')' before identifier 'pFirst' 错误C2146:语法错误:缺少&#39;;&#39; 在标识符“ g_App”之前 - error C2146: syntax error : missing ';' before identifier 'g_App' 错误C2146的可能原因:语法错误:缺少';'在标识符之前 - Possible reason for error C2146: syntax error : missing ';' before identifier
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM