Hi!
I have a doubt about using .pro files.
I'm using QT4 under win32 with codeblocks to develop my apps.
I've been developing in c before using QT and never had this strange behaviour.
The basic question is, I need to use the #include directive if I add those files in .pro file??
Cause I'm have not clear the whole concept of how this works, I'm constantly problems every time I add a new file to the project and spent a lot of time trying to "hack" every file to get it work.
For example, the last problem I've got was a "multiple declaration" error at compile time.
I added a new class:
MapWidget.h
#include <QGLWidget>
{
Q_OBJECT
public:
MapWidget
( int timerInterval
=0,
QWidget* parent
=0,
char* name
=0 );
protected:
void initializeGL();
void resizeGL( int width, int height );
void paintGL();
};
#include <QGLWidget>
class MapWidget : public QGLWidget
{
Q_OBJECT
public:
MapWidget( int timerInterval=0, QWidget* parent=0, char* name=0 );
protected:
void initializeGL();
void resizeGL( int width, int height );
void paintGL();
};
To copy to clipboard, switch view to plain text mode
MapWidget.c
#include "MapWidget.h"
MapWidget
::MapWidget( int timerInterval,
QWidget* parent,
char* name
){
}
void MapWidget::initializeGL()
{
}
void MapWidget::resizeGL( int width, int height )
{
}
void MapWidget::paintGL()
{
}
#include "MapWidget.h"
MapWidget::MapWidget( int timerInterval, QWidget* parent, char* name)
{
}
void MapWidget::initializeGL()
{
}
void MapWidget::resizeGL( int width, int height )
{
}
void MapWidget::paintGL()
{
}
To copy to clipboard, switch view to plain text mode
Then in another already working file, I add MapWidget.c.
This causes the "multiple declaration" error over every MapWidget method.
I checked every file in the project and I don't duplicate the include of MapWidget.c .
If I delete the #include "graphics/MapWidget.c" then all compiles correctly.
What's wrong!?
This is my .pro file:
TEMPLATE = app
TARGET =
DEPENDPATH += . comm debug forms graphics release
QT += opengl
CONFIG += console
CONFIG += qt debug
DESTDIR = bin/
INCLUDEPATH += .
# Input
FORMS += forms/gepeese.ui forms/gps_config.ui
HEADERS += definitions.h \
GuiGPS.hpp \
comm/GPScomm.hpp \
comm/NMEA.hpp \
comm/SerialPort.hpp \
forms/ConfigGPS.hpp \
graphics/MapWidget.hpp
SOURCES += GuiGPS.cpp \
main.cpp \
comm/GPScomm.cpp \
comm/NMEA.cpp \
comm/SerialPort.cpp \
forms/ConfigGPS.cpp \
graphics/MapWidget.cpp
RESOURCES += resources.qrc
TEMPLATE = app
TARGET =
DEPENDPATH += . comm debug forms graphics release
QT += opengl
CONFIG += console
CONFIG += qt debug
DESTDIR = bin/
INCLUDEPATH += .
# Input
FORMS += forms/gepeese.ui forms/gps_config.ui
HEADERS += definitions.h \
GuiGPS.hpp \
comm/GPScomm.hpp \
comm/NMEA.hpp \
comm/SerialPort.hpp \
forms/ConfigGPS.hpp \
graphics/MapWidget.hpp
SOURCES += GuiGPS.cpp \
main.cpp \
comm/GPScomm.cpp \
comm/NMEA.cpp \
comm/SerialPort.cpp \
forms/ConfigGPS.cpp \
graphics/MapWidget.cpp
RESOURCES += resources.qrc
To copy to clipboard, switch view to plain text mode
PD:Sorry about my english.
Bookmarks