Reputation: 49
I'm a Qt beginner, I have the 5.2.1 version and I was trying to learn Qt/QML from a book on Github. However, this is one of the most basic examples:
#ifndef CUSTOMWIDGET_H
#define CUSTOMWIDGET_H
#include <QtWidgets>
class CustomWidget : public QWidget
{
Q_OBJECT
public:
explicit CustomWidget(QWidget *parent = 0);
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
QPoint m_lastPos;
};
#endif // CUSTOMWIDGET_H
And here are the errors I get:
ln function `_start'
undefined reference to `main'
collect2: ld returned 1 exit status
I have no idea what any of these mean, so any help would be appreciated. I made the project as a Qt Quick Application.
These are included in the .pro
file
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
Upvotes: 0
Views: 467
Reputation: 764
First you should go to google and look for the errors, you can find them and the solution, and some solutions are here in stackoverflow too.
For what I can help and hope it helps you:
ln function _start'
With only that I don't know what does it mean, can you copy the full error? Maybe this can help you
undefined reference to main'
Basically you are doing a example in a new project I supose so there is no main() function, which is basic for any program to run. You can add a main.cpp or declare it globaly like void main() {}
Try looking at this and this
collect2: ld returned 1 exit status
means that something was wrong (there are errors before this line), so that's why is the last error.
Upvotes: 1