error: expected ',' or '...' before numeric constant

hwemail101 2015-03-13 09:18:56
union Arg
{
bool b;
char c;
WORD w;
DWORD d;
int i;
float f;
INT64* I;
void* p;
const char* s;
ViPacket* m;
uint64_t* U;

Arg(bool _b) {b = _b;}
Arg(char _c) {c = _c;}
Arg(WORD _w) {w = _w;}
Arg(DWORD _d) {d = _d;}
Arg(int _i) {i = _i;}
Arg(float _f) {f = _f;}
Arg(INT64& _I) {I = &_I;}
Arg(uint64_t& _U) {U = &_U;}
Arg(void* _p) {p = _p;}
Arg(string& _s) {s = _s.c_str();}
Arg(const char* str) {s = str;}
Arg(ViPacket& _m) {m = &_m;}
};
我想问一下为什么Arg(uint64_t& _U) {U = &_U;}这一行会报错误,谢谢各位
...全文
1259 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hwemail101 2015-03-13
  • 打赏
  • 举报
回复
是cygwin编译的时候报错
hwemail101 2015-03-13
  • 打赏
  • 举报
回复
肯定是这一行Arg(uint64_t& _U) {U = &_U;} 现在改成如下了,还是报一样的错 Arg(long long _unsignedInteger64) {unsignedInteger64 = _unsignedInteger64;} 是这样的,windows下面用vs肯定都没有,但是cygwin下面编译就有问题,我为了测试就新建了一个测试工程,的确UINT64不能在cygwin下面编译,发布到安卓。(当然,linux下面也许可以用UINT64,这也许是另外一种解决方案) 不过我在测试工程上用long long类型或者uint64_t都可以的,我就认为是这个问题,但是我在我现在的工程里面用uint64_t或者long long,还是不行,还是报一样的错,就是这一行,注释了编译没有问题,也不是什么tab呀空格格式的问题。
赵4老师 2015-03-13
  • 打赏
  • 举报
回复
偶遇到类似问题都是用 “每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。” 的方法解决的。
hwemail101 2015-03-13
  • 打赏
  • 举报
回复
没有人给我讲吗?
Ubuntu下libxml2的交叉编译 2014-12-26 13:10 本站整理 浏览(587) Ubuntu下libxml2的交叉编译,有需要的朋友可以参考下。 环境为Ubuntu 14.04 LTS 64位 英文版本。 使用的交叉编译工具是arm-linux-gcc-4.3.2.tgz。 一、准备libxml2库 libxml2是一个跨平台的xml文件操作库。 项目地址:http://www.xmlsoft.org/ 我使用的是最新版本libxml2-2.9.2.tar.gz 二、安装 我在在官网提供的网址https://git.gnome.org/browse/libxml2/上下载了几个版本的.tar.gz在Ubuntu下解压以后都没有看到configure文件,然后在ftp://xmlsoft.org/libxml2/下载的版本里却有configure文件……折腾一早上,简直坑爹,希望朋友们少走弯路…… 在解压文件夹下 rootroot@rootroot-virtual-machine:~/wyb$ cd libxml2-2.9.2/ rootroot@rootroot-virtual-machine:~/wyb/libxml2-2.9.2$ ./configure --prefix=/home/rootroot/wyb/libxml2-2.9.2/install CC=arm-linux-gcc LD=arm-linux-ld --enable-shared --enable-static --host=arm-linux --with-python=/home/rootroot/wyb/libxml2-2.9.2/python rootroot@rootroot-virtual-machine:~/wyb/libxml2-2.9.2$ make rootroot@rootroot-virtual-machine:~/wyb/libxml2-2.9.2$ make install 注意修改自己的交叉编译工具。如果不指定python路径(--with-python=/home/rootroot/wyb/libxml2-2.9.2/python),make之后会提示: rootroot@rootroot-virtual-machine:~/wyb/libxml2-2.9.2$ make make[4]: Entering directory `/home/rootroot/wyb/libxml2-2.9.2/python' CC libxml.lo cc1: warning: include location "/usr/include/python2.7" is unsafe for cross-compilation In file included from /usr/include/python2.7/Python.h:8, from libxml.c:14: /usr/include/python2.7/pyconfig.h:15:52: error: arm-linux-gnueabi/python2.7/pyconfig.h: No such file or directory In file included from /usr/include/python2.7/Python.h:77, from libxml.c:14: /usr/include/python2.7/pymath.h:18: warning: redundant redeclaration of 'copysign' /usr/include/python2.7/pymath.h:26: warning: redundant redeclaration of 'hypot' libxml.c: In function 'xmlPythonFileReadRaw': libxml.c:297: error: expected '(' before numeric constant libxml.c: In function 'xmlPythonFileRead': libxml.c:362: error: expected '(' before numeric constant make[4]: *** [libxml.lo] Error 1 make[4]: Leaving directory `/home/rootroot/wyb/libxml2-2.9.2/python' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/rootroot/wyb/libxml2-2.9.2/python' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/rootroot/wyb/libxml2-2.9.2/python' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/rootroot/wyb/libxml2-2.9.2' make: *** [all] Error 2 rootroot@rootroot-virtual-machine:~/wyb/libxml2-2.9.2$ 参考资料: http://blog.csdn.net/q1302182594/article/details/44975527 Linux中交叉编译libxml2 三、测试 随便找一个测试程序: // test.c #include #include #include int main(int argc, char **argv) { xmlDocPtr doc = NULL; xmlNodePtr root_node = NULL, node = NULL, node1 = NULL; doc = xmlNewDoc(BAD_CAST "1.0"); root_node = xmlNewNode(NULL, BAD_CAST "root"); xmlDocSetRootElement(doc, root_node); xmlNewChild(root_node, NULL, BAD_CAST "node1",BAD_CAST "content of node1"); node=xmlNewChild(root_node, NULL, BAD_CAST "node3",BAD_CAST"node has attributes"); xmlNewProp(node, BAD_CAST "attribute", BAD_CAST "yes"); node = xmlNewNode(NULL, BAD_CAST "node4"); node1 = xmlNewText(BAD_CAST"other way to create content"); xmlAddChild(node, node1); xmlAddChild(root_node, node); xmlSaveFormatFileEnc(argc > 1 ? argv[1] : "-", doc, "UTF-8", 1); xmlFreeDoc(doc); xmlCleanupParser(); xmlMemoryDump(); return(0); } 编译: rootroot@rootroot-virtual-machine:~/wyb$ arm-linux-gcc -I /home/rootroot/wyb/libxml2-2.9.2/install/include/libxml2 -L /home/rootroot/wyb/libxml2-2.9.2/install/lib -lxml2 test.c -o test rootroot@rootroot-virtual-machine:~/wyb$ file test test: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped rootroot@rootroot-virtual-machine:~/wyb$
****************************** * 编 译 错 误 信 息 * ******************************* '''';'''' not allowed before ''''ELSE'''' ElSE前不允许有“;” '''''''' clause not allowed in OLE automation section 在OLE自动区段不允许“”子句 '''''''' is not a type identifier 不是类型标识符 '''''''' not previously declared as a PROPERTY 前面没有说明PROPERTY ''''GOTO '''' leads into or out of TRY statement GOTO 进入或超出TRY语句的范围 clause expected, but found 要求子句,但出现 16-Bit fixup encountered in object file '''''''' 在对象文件遇到16位修复 486/487 instructions not enabled 不能用486/487指令 Abstract methods must be virtual or dynamic 抽象方法必须为虚拟的或动态的 Array type required 需要数组类型 Assignment to FOR-Loop variable '''''''' 给FOR循环变量赋值 Bad argument type in variable type array constructor 在变量类型数组结构中不正确的参数类型 Bad file format '''''''' 错误的文件格式 Bad file format: 错误的文件格式 Bad global symbol definition: '''''''' in object file '''''''' 对象文件''''''''中错误的全局符号定义'''''''' Bad unit format: 错误的单元格式 BREAK or CONTINUE outside of loop BREAK或CONTINUE超出循环 Cannot add or subtract relocatable symbols 不能增加或减少可重置的符号 Cannot assign to a read-only property 不能指定只读属性 Cannot BREAK, CONTINUE or EXIT out of a FINALLY clause 超出FINALLY子句的范围,不能使用BREAK,CONTINUE或EXIT语句 Cannot initialize local variables 不能初始化局部变量 Cannot initialize multiple variables 不能初始化多个变量 Cannot initialize thread local variables 不能初始化线程局部变量 Cannot override a static method 不能覆盖静态方法 Cannot read a write-only property 不能读取只写属性 Case label outside of range of case expression CASE标号超出了CASE表达式的范围 Circular unit reference to 对单元循环引用 Class already has a default property 类已具有默认的属性 Class does not have a default property 类没有默认的属性 Class or object types only allowed in type section 在类型区段只允许有类或对象类型 Class type required 需要类类型 Close error on 文件关闭错误 Compile terminated by user 用户中止编译 Constant expected 要求常量 Constant expression expected 要求常量表达式 Constant expression violates subrange bounds 常量表达式超出子界范围 Constant object cannot be passed as var parameter 常量对象不能作为变量参数传递 Constant or type identifier expected 要求常量或类型标识符 Constants cannot be used as open array arguments 常量不能用作打开数组参数 Constructing instance of '''''''' containing abstract methods 构造的实体包含抽象的方法 Could not compile used unit '''''''' 不能用单元编译 Could not create output file 不能建立输出文件 Could not load RLINK32.DLL 不能加载RLINK32.DLL Data type too large: exceeds 2 GB 数据类型太大:超过2GB Declaration of differs from previous declaration 的说明与先前的说明不同 Default property must be an array property 默认的属性必须为数组属性 Default values must be of ordinal, pointer or small set type 默认的值必须为序数、指针或小集类型 Destination cannot be assigned to 目标不能指定 Destination is inaccessible 目标不能存取 Dispid '''''''' already used by '''''''' DISPID标识号已被使用 Dispid clause only allowed in OLE automation section DISPID子句只能在OLE自动区段中使用 Division by zero 除数为零 Duplicate case label CASE标号重复 Duplicate tag value 重复的标志值 Dynamic method or message handler not allowed here 这里不允许有动态方法或信息处理程序 Dynamic methods and message handlers not allowed in OLE automation section在OLE自动区段不允许有动态方法或消息处理程序 Element 0 inaccessible - use ''''Length'''' or ''''SetLength'''' 元素0不能存取-使用LENGTH或SETLENGTH Error in numeric constant 数值常量错误 EXCEPT or FINALLY expected 要求EXCEPT或FINALLY EXPORTS allowed only at global scope EXPORTS只允许在全局范围使用 Expression has no value 表达式没有值 Expression too complicated 表达式太复杂 Field definition not allowed in OLE automation section 在OLE自动区段中不允许域定义 Field definition not allowed after methods or properties 在方法或属性后不允许域定义 Field or method identifier expected 要求域或方法标识符 File not found: 文件没有找到 File type not allowed here 这儿不允许文件类型 For loop control variable must be simple local variable FOR循环控制变量必须为简单局部变量 For loop control variable must have ordinal type FOR循环控制变量必须为序数类型 FOR or WHILE loop executes zero times - deleted FOR或WHILE循环执行零次-删除 FOR-Loop variable '''''''' cannot be passed as var parameter FOR循环变量不能作为参数传递 FOR-Loop variable '''''''' may be undefined after loop 在循环后的FOR循环变量是不确定的 Function needs result type 函数需要结果类型 Identifier redeclared: '''''''' 标识符重复说明 Illegal character in input file: '''''''' ($) 在输入文件中的非法字符'''''''' Illegal message method index 非法的消息方法指针 Illegal reference to symbol '''''''' in object file '''''''' 在对象文件中对符号的非法引用 Illegal type in OLE automation section: '''''''' 在OLE自动区段中的非法类型 Illegal type in Read/Readln statement 在Read/Readln语句中的非法类型 Illegal type in Write/Writeln statement 在Write/Writeln语句中的非法类型 Inaccessible value 不可存取的值 Incompatible types: '''''''' and '''''''' 不兼容的类型和 Incompatible types: 不兼容的类型 Inline assembler stack overflow 内联汇编溢出 Inline assembler syntax error 内联汇编语法错误 Instance variable '''''''' inaccessible here 实体变量在这里不能存取

64,688

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧