Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I solve this error ?



  • Hello,

    I am using Ubuntu OS 18.04.3 and Qt 5.13.1.

    Here compiler output:

    In file included from /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:105:0,
                     from /opt/Qt/5.13.1/gcc_64/include/QtCore/qalgorithms.h:43,
                     from /opt/Qt/5.13.1/gcc_64/include/QtCore/qdebug.h:44,
                     from LowPassFilter.h:3,
                     from LowPassFilter.cpp:1:
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:414:1: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOTHROW;
     ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:733:33: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
                                     ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:741:1: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
     ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:778:1: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
     ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:784:1: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW;
     ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:802:1: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW;
     ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:812:12: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) Q_DECL_NOTHROW;
                ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qcompilerdetection.h:223:41: error: expected constructor, destructor, or type conversion before ‘(’ token
     #    define Q_DECL_IMPORT     __declspec(dllimport)
                                             ^
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:360:27: note: in expansion of macro ‘Q_DECL_IMPORT’
     #    define Q_CORE_EXPORT Q_DECL_IMPORT
                               ^~~~~~~~~~~~~
    /opt/Qt/5.13.1/gcc_64/include/QtCore/qglobal.h:814:1: note: in expansion of macro ‘Q_CORE_EXPORT’
     Q_CORE_EXPORT void qBadAlloc();
     ^~~~~~~~~~~~~
    

    any suggestion how can I solve this error?
    any module do i need to Install in Linux?



  • @Yash001 said in How can I solve this error ?:
    __declspec(dllimport) is used when compiling under Windows, and for MSVC only I think. So somehow I think that is what your compilation has been configured for?



  • @Yash001 said in How can I solve this error ?:
    __declspec(dllimport) is used when compiling under Windows, and for MSVC only I think. So somehow I think that is what your compilation has been configured for?



  • @JonB Thank you sir, you right.

    I did mistake in .pro file. I mention DEFINE like below.
    DEFINES += WIN64 SQUIDSTATELIBRARY_LIB. To solve this error replace I replace to DEFINES += SQUIDSTATELIBRARY_LIB and it is work.

    I don't know some how it is work on mac, but on Linux it was giving me error.

    Thank you.