Ok, Fehlermeldung ist (z.B.)
gamepad.cpp

Fehler:multiple definition of `CLSID_DirectInput' gamepad.cpp
Fehler:first defined here main.cpp
Und so geht es dann munter weiter. Die main.cpp:
Code: Alles auswählen
#include <QtGui/QApplication>
#include "mainwindow.h"
#include "gamepad.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
die gamepad.h:
Code: Alles auswählen
#ifndef GAMEPAD_H
#define GAMEPAD_H
#include <QtCore/QCoreApplication>
#include <QThread>
#include <windows.h>
#include <string.h>
#include <iostream>
#include <initguid.h>
#include <dinput.h> // DirectInput header
class GamepadThread : public QThread
{
Q_OBJECT
signals:
void sendGamepadData(QList<int> Data);
private:
void run();
private slots:
void getGamepadData();
};
#endif // GAMEPAD_H
Und zum Schluss noch die gamepad.cpp:
Code: Alles auswählen
#include "gamepad.h"
#include <QtGui>
void GamepadThread::run()
{
QTimer timer;
connect(&timer, SIGNAL(timeout()), this, SLOT(getGamepadData()), Qt::DirectConnection);
timer.setInterval(100);
timer.start(); // puts one event in the threads event queue
exec();
timer.stop();
}
void GamepadThread::getGamepadData()
{
}
Alle Fehler betreffen die "dinput.h" in der gamepad.h
Viele Grüße
Christoph