QBS Defines



  • I'm trying to convert my qmake project to qbs but i've blocked on a dynamic library. Here's my simple qbs project file:
    @import qbs

    DynamicLibrary {
    Depends { name: 'Qt'; submodules: ['core', 'gui', 'network', 'xml'] }
    cpp.defines: base.concat(['READERMANAGERLIB_LIBRARY'])
    Group {
    name: 'Sources'
    files: ['.cpp']
    }
    Group {
    name: 'Headers'
    files: ['
    .h']
    }
    }@

    But i'm getting errors about using Q_DECL_IMPORT instead of Q_DECL_EXPORT. Normally READERMANAGERLIB_LIBRARY define takes care of this but i think QBS doesn't forward my cpp.defines to VS2010 compiler. Here's the compile log:

    @...
    ... some successful moc'ing and compiling ...
    ...
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin/cl.exe /nologo /c /EHsc /Zi /MDd /ID:\Qt\Qt4.8.4\mkspecs\win32-msvc2010 /ID:\Qt\Qt4.8.4\include\QtCore /ID:\Qt\Qt4.8.4\include /IC:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader /ID:\Qt\Qt4.8.4\include /ID:\Qt\Qt4.8.4\include\QtGui /ID:\Qt\Qt4.8.4\include /ID:\Qt\Qt4.8.4\include\QtNetwork /ID:\Qt\Qt4.8.4\include /ID:\Qt\Qt4.8.4\include\QtXml /DUNICODE /D_UNICODE /DQT_CORE_LIB /DQT_GUI_LIB /DQT_NETWORK_LIB /DQT_XML_LIB /FoC:\reader-build\qtc_4_8_4-debug.obj\reader\GeneratedFiles\reader\moc_reader.cpp.obj C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp /TP /Zm200 /Zc:wchar_t-
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(58) : warning C4273: 'Reader::qt_static_metacall' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(23) : see previous definition of 'qt_static_metacall'
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(75) : warning C4273: 'staticMetaObjectExtraData' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(23) : see previous definition of 'private: static QMetaObjectExtraData const Reader::staticMetaObjectExtraData'
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(75) : error C2491: 'Reader::staticMetaObjectExtraData' : definition of dllimport static data member not allowed
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(79) : warning C4273: 'staticMetaObject' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(23) : see previous definition of 'public: static QMetaObject const Reader::staticMetaObject'
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(79) : error C2491: 'Reader::staticMetaObject' : definition of dllimport static data member not allowed
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(89) : warning C4273: 'Reader::metaObject' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(23) : see previous definition of 'metaObject'
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(94) : warning C4273: 'Reader::qt_metacast' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(23) : see previous definition of 'qt_metacast'
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(104) : warning C4273: 'Reader::qt_metacall' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(23) : see previous definition of 'qt_metacall'
    C:\reader-build\qtc_4_8_4-debug\GeneratedFiles\reader\moc_reader.cpp(145) : warning C4273: 'Reader::errorOccured' : inconsistent dll linkage
    C:\reader-build\qtc_4_8_4-debug\generatedfiles\reader../../../../reader/reader.h(57) : see previous definition of 'errorOccured'
    ...
    ... some similar error messages ...
    ...@



  • Found the solution. It also needs cpp dependency. After adding
    @Depends { name: 'cpp' }@

    it worked.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.