Compiling QJson statically into a Qt application (multiple declaration errors)

Has anyone successfully compiled QJson statically into an application? I am trying to use QJson statically in my Qt application (Windows / Mac), that is, I am trying to use the source files directly and not compile the DLL and use it. Is it possible? My program produces a lot of errors when I try to do this, mostly "multiple declaration" errors. They are apparently related to the presence of such a structure of methods as this:

SerializerRunnable::SerializerRunnable(QObject* parent)
    : QObject(parent),
      QRunnable(),
      d(new Private)
{
  qRegisterMetaType<QVariant>("QVariant");
}
SerializerRunnable::~SerializerRunnable()
{
  delete d;
}

Any ideas would be appreciated.

Thank,

+3
source share
1 answer

, DLL, , , .

qjson_export.h:

#ifndef QJSON_EXPORT_H
#define QJSON_EXPORT_H

#include <QtCore/qglobal.h>

#ifndef QJSON_EXPORT
# if defined(QJSON_MAKEDLL)
   /* We are building this library */
#  define QJSON_EXPORT Q_DECL_EXPORT
# else
   /* We are using this library */
#  define QJSON_EXPORT Q_DECL_IMPORT
# endif
#endif

#endif

DEFINES += QJSON_MAKEDLL .pro, , DLL, , , " " Q_DECL_EXPORT, , , , .

, .: P

+2

Source: https://habr.com/ru/post/1769239/


All Articles