[英]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.