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

__FILE__ , __FUNCTION__ any similar macros to help identify subproject ?



  • Question :
    Is there a similar macro to help identify sub project in SUBDIRS scheme?

    I like to be able to identify the actual "run"/ trace process in "SUBDIRS" execution.

    I am aware of "sequence" of "SUBDIIRS" as specified in main project .
    I like to trace the actual code execution via QDebug messages.

    So far "main " FILE and FUNCTION do not distinguish between projects.

    This is what I have so far
    #ifdef DEBUG
    // test QDebug
    qDebug() << "File "<< FILE;
    qDebug() << "Function @line "<< LINE << " __ " << FUNCTION ;
    qDebug() << "Date:" << QDate::currentDate();
    // qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
    #endif

    Maybe some kind of "custom #define subprojecX " would work ?
    But that would not identify the run sequence...

    #ifdef subprojectX
    qDebug () << " in ___FUNCTION __ in subproject X ";
    #elseif subroiject y

    ....


  • Lifetime Qt Champion

    Hi,

    No there's not.

    However you can use Q_FUNC_INFO that provides detailed informations so unless you have a lot of similar code, it should already help locate your issues more easily.


  • Lifetime Qt Champion

    Hi,

    No there's not.

    However you can use Q_FUNC_INFO that provides detailed informations so unless you have a lot of similar code, it should already help locate your issues more easily.



  • Perfect,
    just modified Q_FUNC_INFO and added the subproject name.
    Better than silly preprocessor idea. Many thanks.

    QString funct_info =" btscanner main ";
    qDebug() << "Called " << funct_info << Q_FUNC_INFO ;

    PS
    There got to be "btscanner" as label / string /name somewhere....


Log in to reply