Hi programmers! I'm a new member in this (fantastic) community. I started to learn Qt some weeks ago, and now I have a problem. I want to develop a little IDE for C/C++, and my friends recommend me that I'd use QScintilla for the central editor widget. Well, I download and install it, compile the example and all works fine, but when I make a new application in other directory, I found this problem:
this is an trivial example:
#include <QtGui>
#include <QApplication>
#include <Qsci/qsciscintilla.h>
int main (int a,char* b[])
{
QsciScintilla *textEdit = new QsciScintilla;
textEdit->show();
return app.exec();
}
#include <QtGui>
#include <QApplication>
#include <Qsci/qsciscintilla.h>
int main (int a,char* b[])
{
QApplication app(a,b);
QsciScintilla *textEdit = new QsciScintilla;
textEdit->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
the problem is when I run make, this is the error message:
main.o: In function `main':
main.cpp: (.text+0x44): undefined reference to `QsciScintilla::QsciScintilla(QWidget*)'
collect2: ld returned 1 exit status
the make rules for compiling are the following:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
g++ -Wl,-O1 -o application main.o -L/usr/lib -lQtGui -lQtCore -lpthread
I think this error occurs due to the linker cannot find the dynamic library of QScintilla. The headers files are good placing.
Thanks and sorry for my horrible English XD
Added after 13 minutes:
Ok I found the solution: add LIBS += -lqscintilla to the .pro file
Sorry, beginner fail. The thread can be closed.
Bookmarks