PDA

View Full Version : unresolved external symbol with qwt3d



pospiech
23rd August 2009, 12:12
I am trying to use the libary qwt3d.

I created a simple class to use it:



#ifndef QPLOT3D_H_
#define QPLOT3D_H_

#include <qwt3d_surfaceplot.h>
#include <qwt3d_function.h>

using namespace Qwt3D;

class QPlot3D : public SurfacePlot
{
Q_OBJECT
public:
QPlot3D(QWidget* parent = 0, Qt::WFlags flags = 0);
virtual ~QPlot3D();

};
#endif




#include "QPlot3D.h"

QPlot3D::QPlot3D( QWidget* parent /*= 0*/, Qt::WFlags flags /*= 0*/ )
: SurfacePlot(parent)
{
}

QPlot3D::~QPlot3D()
{
}


which results only in the linker error:

1>moc_QPlot3D.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const Qwt3D::SurfacePlot::staticMetaObject" (?staticMetaObject@SurfacePlot@Qwt3D@@2UQMetaObjec t@@B)


the libary (.lib) files are loaded, the moc file is part of the project and compiled.
Therefore I do not see what is missing.

caduel
23rd August 2009, 12:36
looks ok, are you sure you're linking against the qwt3d library? (might be there is another version and you have the wrong one?)

pospiech
23rd August 2009, 12:40
looks ok, are you sure you're linking against the qwt3d library? (might be there is another version and you have the wrong one?)
How could I check if the version is correct?

I am using VS 2005 and Qt 4.5.2

caduel
23rd August 2009, 14:25
sorry, linux user here. i'd just use the disk search and search for qwt3d libs and includes (you know the names). if you get multiple hits, that might be the issue. (might be a bug in qwt3d, too, though. never used it.)

pospiech
23rd August 2009, 15:36
I would get multiple hits, but the lib file is in the correct project directory and the dll in the bin path of the project.

So everything happens in the project paths and nothing in the system is involved.

vminotto
20th April 2010, 00:03
I know I'm a little bit late, but this might help somebody.

I had the exactly same problem you were having, and after many hours of googling and messing with my project's properties I think I may have found a solution.

I compared a working example with my own code, and found out the PREPROCESSOR definitions were pretty different.
I have just copy pasted those definitions (from the "autoswitch" provided example) and everything compiled just fine.

Note that for debug and release versions, the definitions change quite a little. If you have any doubt of which one to use, I would recommend you to check the PREPROCESSOR label of the autoswitch example.

These are the following definitions that are provided in the example (the ones you should copy to your own project).

For Debug mode:

_WINDOWS;UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_DLL ;QWT3D_DLL;QT_THREAD_SUPPORT;QT_OPENGL_LIB;QT_GUI_ LIB;QT_CORE_LIB



For Release mode:

QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGE FILE_SUPPORT,QT_DLL,QWT3D_DLL,QT_THREAD_SUPPORT,QT _DLL,QT_NO_DEBUG,QT_OPENGL_LIB,QT_GUI_LIB,QT_CORE_ LIB,NDEBUG


I do not know why this solved the problem. I am new to the Qt SDK. If someone can provide a more specific explanation, I would be happy to know.

Oh, I almost forgot to mention, all this was done using QT 4.6.2, MVS 2008 and QwtPlot3D 0.2.7.

I hope this works for anybody that face this same problem.

Cheers!
Vincent.

phenoboy
2nd February 2016, 21:47
had the same problem and this solved it:

DEFINES += QWT3D_DLL