【发布时间】:2018-08-01 08:52:22
【问题描述】:
当我尝试在 CentOS 7.5 中执行语法服务器代码(包含 c 和 c++ 文件)时遇到以下错误
获得错误:
[command-line]:0:8: error: multiple types in one declaration
[command-line]:0:8: error: declaration does not declare anything `enter code here`[-fpermissive]
[command-line]:0:7: error: multiple types in one declaration
[command-line]:0:7: error: declaration does not declare anything [-fpermissive]
In file included from /usr/include/_G_config.h:15:0,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:74,
from jsapi.h:47,
from jsatom.h:47,
from jscntxt.h:59,
from jsanalyze.h:45,
from jsanalyze.cpp:40:
jsfun.h: In static member function ‘static uintN JSFunction::offsetOfNativeOrScript()’:
jsfun.h:230:37: warning: invalid access to non-static data member ‘JSFunction::u’ of NULL object [-Winvalid-offsetof]
return offsetof(JSFunction, u.nativeOrScript);
^
jsfun.h:230:37: warning: (perhaps the ‘offsetof’ macro was used incorrectly) [-Winvalid-offsetof]
In file included from /usr/include/time.h:37:0,
from prmjtime.h:46,
from jscntxt.h:75,
from jsanalyze.h:45,
from jsanalyze.cpp:40:
jscntxt.h: In function ‘JSContext* js_ContextFromLinkField(JSCList*)’:
jscntxt.h:2963:64: warning: invalid access to non-static data member ‘JSContext::link’ of NULL object [-Winvalid-offsetof]
return (JSContext *) ((uint8 *) link - offsetof(JSContext, link));
^
jscntxt.h:2963:64: warning: (perhaps the ‘offsetof’ macro was used incorrectly) [-Winvalid-offsetof]
make[1]: *** [jsanalyze.o] Error 1
我无法找出问题所在。任何人都可以帮我解决这个问题吗? 谢谢你
【问题讨论】:
-
你能发一个Minimal complete verfiable example吗?不看代码我们什么也说不出来
-
一个声明中的多种类型让我们认为您使用了保留字作为变量名......只是一个疯狂的猜测,因为您未能显示导致错误的来源。
-
感谢您的回复。我有一组文件,不确定是由于哪个文件引起的错误。因此我未能分享代码。