PDA

View Full Version : extend QScintilla class



creatio.x
27th September 2011, 16:44
I've been trying to extend the QScintilla class to add some functionality that I'm missing, but I keep running into some errors. My header file looks like the following:



#ifndef EDITOR_H
#define EDITOR_H

#include <QKeyEvent>
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintilla.h>

class QSCINTILLA_EXPORT Editor : public QsciScintilla
{
Q_OBJECT

public:
Editor(QWidget* parent = 0);
virtual ~Editor();

signals:

public slots:
void keyPressEvent(QKeyEvent* e);

private:

};

#endif // EDITOR_H

My current .pro file looks as:



#-------------------------------------------------
#
# Project created by QtCreator 2011-09-20T18:58:15
#
#-------------------------------------------------
# http://hackage.haskell.org/trac/haskell-prime/wiki/UnicodeInHaskellSource

TARGET = naelc
TEMPLATE = app
QT += core gui
DEFINES += QSCINTILLA_DLL #__SPECIAL_WINDOWS_DEFINE__
LIBS += -lqscintilla2
DEPENDPATH += .

SOURCES += src/main.cpp\
src/naelc.cpp \
src/projectswidget.cpp \
src/editorwidget.cpp \
src/constants.cpp \
src/project.cpp \
src/orientationbutton.cpp \
src/module.cpp \
src/editor.cpp

HEADERS += src/naelc.h \
src/projectswidget.h \
src/editorwidget.h \
src/constants.h \
src/project.h \
src/orientationbutton.h \
src/module.h \
src/editor.h \

FORMS += ui/naelc.ui \
ui/projectswidget.ui \
ui/editorwidget.ui

RESOURCES += \
resources.qrc


When I compile this though, I keep getting the following errors:


./release\editorwidget.o:editorwidget.cpp:(.text+0x3 13): undefined reference to `_imp___ZN6EditorC1EP7QWidget'
./release\editorwidget.o:editorwidget.cpp:(.text+0x7 13): undefined reference to `_imp___ZN6EditorC1EP7QWidget'
./release\editor.o:editor.cpp:(.text+0xfb): undefined reference to `_imp___ZTV6Editor'
./release\editor.o:editor.cpp:(.text+0x123): undefined reference to `_imp___ZTV6Editor'
./release\editor.o:editor.cpp:(.text+0x153): undefined reference to `_imp___ZTV6Editor'
./release\editor.o:editor.cpp:(.text+0x197): undefined reference to `_imp___ZTV6Editor'
./release\editor.o:editor.cpp:(.text+0x1cb): undefined reference to `_imp___ZTV6Editor'
./release\moc_editor.o:moc_editor.cpp:(.text+0x15): undefined reference to `_imp___ZN6Editor16staticMetaObjectE'
./release\moc_editor.o:moc_editor.cpp:(.text+0x26): undefined reference to `_imp___ZN6Editor16staticMetaObjectE'

I have no clue what is going on here. My guess would be that I would have to define Editor in a separate project and export it's own .dll file and use that inside my project.

dvirtz
4th October 2011, 14:32
I think you should remove the QSCINTILLA_EXPORT from the class definition.