2013年11月26日
1、
错误:在嵌套模板实参列表中应当使用 ‘>>’ 而非 ‘>>
代码:typedef map> map_u64_pu64;
更正:typedef map< Uint64, pair > map_u64_pu64;
map后面的一对尖括号里可以有空格。在上面的例子里,pair的>和map的>之间应该有空格。
2、
错误:友元声明没有指定类或函数名
错误:声明友元时必须使用 class 关键字
代码:friend Singleton;
更正:friend class Singleton;
3、(笔误。。。)
错误:对成员 ‘get_supid’ 的请求出现在 ‘Singleton::Instance [with T = CMapPartInfo]’ 中,而后者具有非类类型 ‘CMapPartInfo& ()()’
代码:bRet = CMapPartInfo::Instance.get_supid(data.PartID, FatherPartID);
更正:bRet = CMapPartInfo::Instance().get_supid(data.PartID, FatherPartID);
少了个()!
4、(低级。。。)
错误:不能将 ‘bool’ 转换为 ‘char*’,在 assignment 中
代码:while(p=strrchr(id_list,',') != NULL)
更正:while((p=strrchr(id_list,',')) != NULL)
优先级的问题,!=优先级比=高
5、编译pc文件时报错:
Syntax error at line 1443, column 5, file src/OperDB.pc:
Error at line 1443, column 5 in file src/OperDB.pc
while ( (nIndex = GetConn(&ctx))<0 )/*取出可以用的数据库连接句柄*/
....1
PCC-S-02201, Encountered the symbol "while" when expecting one of the following: auto, char, const, double, enum, extern, float, int, long,
ulong_varchar, OCIBFileLocator OCIBlobLocator,
OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,
OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,
short, signed, sql_context, sql_cursor, static, struct,
typedef, union, unsigned, utext, uvarchar, varchar, void,
volatile, a typedef name, a precompiled header, exec oracle,
exec oracle begin, exec, exec sql, exec sql begin,
exec sql end, exec sql type, exec sql var, exec sql include,
错误原因:仅使用了EXEC SQL BEGIN DECLARE SECTION;,未使用EXEC SQL END DECLARE SECTION;与之相匹配。
6、
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h:In instantiation of ‘std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:135: instantiated from ‘std::_Rb_tree_node<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>>’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:1264: instantiated from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree_node<_Val>*)[with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char>>, _Val = std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>, _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>>, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char>>>, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>>]’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:578: instantiated from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree()[with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char>>, _Val = std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>, _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>>, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char>>>, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<long long unsigned int, long long unsigned int, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, long long unsigned int>>>>>]’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h:93: instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h:73: 错误:‘std::pair<_T1, _T2>::first’ has incomplete type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/strin**d.h:56: 错误:declaration of ‘const struct std::basic_string<char, std::char_traits<char>, std::allocator<char>>’