预期在 ‘;’ 之前有不合格的 id代币
我似乎遇到了一个奇怪的问题:
我用 C++ 编写了一个应用程序(使用 Eclipse CDT),该应用程序使用 Mozilla 的 Netword 安全服务。这个应用程序运行良好,所以我想我可以将适当的类/标头/源移动到另一个项目(通常可以这样做吗?)。原始项目使用位于 /usr/include/nspr
和 libnss3
中的一些附加标头。
这个另一个项目是使用 CMake 编译的。因此,我告诉 CMake 将 /usr/include/nspr
添加到包含路径并使用 libnss3
。但是,当我尝试使用其他项目中的类时,编译时出现以下错误:
In file included from some-dir/src/import/FirefoxImporter.h:21:0,
from some-dir/src/import/Import_Firefox.h:26,
from some-dir/src/mainwindow.cpp:28:
/usr/include/nss/secmodt.h:85:25: error: expected unqualified-id before ‘;’ token
secmodt.h
中的第 85 行如下所示:
PK11SlotInfo **slots; /* array of slot points attached to this mod*/
并且 PK11SlotInfo
is typedef' secmodt.h
中的 d:
typedef struct PK11SlotInfoStr PK11SlotInfo; /* defined in secmodti.h */
但是,我无法在我的系统上找到 secmodti.h
(但是,原始程序编译并执行得很好)。
有没有人遇到过类似的问题并解决了?
I seem to have a strange problem:
I coded an application in C++ (using Eclipse CDT) that uses Mozilla's Netword Security Services. This application is running fine, so I thought I can just move the appropriate classes/headers/sources to another project (can this generally be done?). The original project uses some additional headers located in /usr/include/nspr
and libnss3
.
This other project is compiled using CMake. So I told CMake to add /usr/include/nspr
to the include path and to use libnss3
. However, when I try using the classes within this other project, I get the following error when compiling:
In file included from some-dir/src/import/FirefoxImporter.h:21:0,
from some-dir/src/import/Import_Firefox.h:26,
from some-dir/src/mainwindow.cpp:28:
/usr/include/nss/secmodt.h:85:25: error: expected unqualified-id before ‘;’ token
Line 85 in secmodt.h
looks as follows:
PK11SlotInfo **slots; /* array of slot points attached to this mod*/
And PK11SlotInfo
is typedef'd in secmodt.h
:
typedef struct PK11SlotInfoStr PK11SlotInfo; /* defined in secmodti.h */
However, I was not able to locate secmodti.h
on my system (however, the original program compiled and executed just fine).
Has anybody experienced similar problems and solved them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑你在 secmodt.h 之前包含了 QT。 “slots”是 QT moc 关键字。
更新
我猜到这一点是因为 QT 是一个流行的库(并且我知道它对
槽
的使用)。另外,这种类型的错误看起来像是典型的预处理器废话。QT 的
#define
d“槽”不用于其元对象编译器。您可以:(可能?)在
secmodt.h
之后的某个时间点包含 QT,或(可能?)将no_keywords
添加到您的配置 - 然后祈祷献给编译器之神。i suspect you have included QT before secmodt.h. 'slots' is a QT moc keyword.
Update
i guessed this because QT is a popular library (and i knew of its usage of
slots
). plus, this type of error looked like typical preprocessor nonsense.QT's
#define
d 'slots' to nothing for use with its Meta Object Compiler.you can either: (possibly?) include QT at some point after
secmodt.h
, or (possibly?) addno_keywords
to your config -- then pray to the compiler gods.