Hey all I’m been searching awhile and I can’t find a solution so… I’m trying to build this dynamic library and it keeps outputting this type of errors:
error: undefined reference to `Enum::toString() const'
error: undefined reference to `_imp___ZN4EnumC2Ei'
error: undefined reference to `_imp___ZN4EnumD2Ev'
[...]
and in my *.pro file I have DEFINES += CUSTOMER_DLL, so I’m kinda guessing the problem can be determined from these 2 files:
custType.h
#ifndef _CUST_TYPE_H_
#define _CUST_TYPE_H_
#include <enum.h>
#include "cexport.h"
class CUSTOMER_EXPORT CustomerType : public Enum {
public:
CustomerType(int value=0): Enum(value) {}
CustomerType(QString ctyp);
const NameMap& nameMap() const;
};
#endif
cexport.h
#ifndef CUSTOMER_EXPORT
#include <QtGlobal>
/** Macro definition for exporting symbols to a DLL on Windows */
#ifndef Q_OS_WIN
#define CUSTOMER_EXPORT
#elif defined(CUSTOMER_DLL)
#define CUSTOMER_EXPORT Q_DECL_EXPORT
#else
#define CUSTOMER_EXPORT Q_DECL_IMPORT
#endif
#endif // #ifndef CUSTOMER_EXPORT
This is part of the source code from ‘An Introduction to Design Patterns in C++ with Qt’ in the libs folder. Let me know if I’m missing out anything.
Windows 7 32bit, Qt 4 and 5
↧