[Qt-creator] make tries to link .obj file that will never be build
Matthias Pospiech
matthias.pospiech at gmx.de
Mon Jul 19 17:59:45 CEST 2010
I am trying to work around the __dllspec Definitions in a case where I
want to use a class in different dlls.
What I have done now is to move the class which is used in many project
to a header file only
and include that in the project class file. This looks like this:
----------------->
#ifndef CAMERAIMAGE_H_
#define CAMERAIMAGE_H_
// for each project using this file this needs to be defined
#ifdef QSMXCAMERA_EXPORT
#define QCAMERAIMAGEEXPORT QSMXCAMERA_EXPORT
#else
#define QCAMERAIMAGEEXPORT
#endif
class QCAMERAIMAGEEXPORT QCameraImage : public QWidget
{
Q_OBJECT
public:
...
};
#endif
<--------------
----------------->
#ifndef QCAMERAWIDGET_H
#define QCAMERAWIDGET_H
// this class is in the project and knows how to define QSMXCAMERA_EXPORT
#include "QCameraSMXGlobal.h"
#include "QCameraImage.h"
class QSMXCAMERA_EXPORT QCameraWidget : public QCameraImage
{
Q_OBJECT
public:
explicit QCameraWidget(QWidget *parent = 0);
signals:
public slots:
};
#endif // QCAMERAWIDGET_H
<--------------
With this however I get the error
LINK : fatal error LNK1181: Eingabedatei "build\debug\QCameraImage.obj"
kann nicht geöffnet werden.
However there is no QCameraImage.cpp which could be build. And I can not
include such a file because then the header would be loaded with
incorrect Export definitions.
Why is this happening and how can I get around it?
Concerning QtCreator - is there anything I can define within the .pro
file to solve this?
Matthias
More information about the Qt-creator-old
mailing list