需要帮助在 Ubuntu 中使用 Eclipse 创建 log4cxx 附加程序
当尝试从 AppenderSkeleton 继承时,当我尝试编译时,我收到“错误:预期的类名在 '{' 标记之前”。我似乎无法识别该类,但我引用了 log4cxx 库并包含了appendersculpt.h 文件。
.h 文件如下:
#include <log4cxx/appenderskeleton.h>
//#include <vector>
#ifndef SERVICEAPPENDER_H_
#define SERVICEAPPENDER_H_
class ServiceAppender : public AppenderSkeleton {
{
public:
ServiceAppender();
virtual ~ServiceAppender();
};
#endif
有一个 ServiceAppender.cpp 文件,但目前除了对上面文件的引用之外什么都没有。我正在使用包含以下内容的 make 文件:
CC=g++
CFLAGS=-c
EXECUTABLE=testservice
CPPFLAGS= -I/usr/local/lib -I/usr/include/libxml++-2.6 \
-I/usr/lib/libxml++-2.6/include -I/usr/include/libxml2 \
-I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include \
-I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
LIBS= -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lgthread-2.0 \
-lrt -lglib-2.0 -lboost_thread -llog4cxx -lcurlpp -lpthread -lapr-1
似乎我可能缺少库/引用,但作为 c++ 菜鸟,我不知道那可能是什么。
When attempting to inherit from AppenderSkeleton I get "error: expected class-name before ‘{’ token " when I attempt to compile. I seems to not be recognizing the class but I am referencing the log4cxx library and have included the appenderskeleton.h file.
The .h file is below:
#include <log4cxx/appenderskeleton.h>
//#include <vector>
#ifndef SERVICEAPPENDER_H_
#define SERVICEAPPENDER_H_
class ServiceAppender : public AppenderSkeleton {
{
public:
ServiceAppender();
virtual ~ServiceAppender();
};
#endif
There is a ServiceAppender.cpp file but currently has nothing in it but a reference to file above. I am using a make file with the following :
CC=g++
CFLAGS=-c
EXECUTABLE=testservice
CPPFLAGS= -I/usr/local/lib -I/usr/include/libxml++-2.6 \
-I/usr/lib/libxml++-2.6/include -I/usr/include/libxml2 \
-I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include \
-I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
LIBS= -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lgthread-2.0 \
-lrt -lglib-2.0 -lboost_thread -llog4cxx -lcurlpp -lpthread -lapr-1
It seems I may be missing a library/reference but as c++ noob, I have no idea what that might be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AppenderSkeleton 是否在命名空间中?在这种情况下,您必须限定类名,以便编译器能够正确解析符号。
Is AppenderSkeleton in a namespace by any chance? In that case you'd have to qualify the class name for the compiler to be able to properly resolve the symbol.