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

Preproccessing



  • I am not very familiar with how to incorporate predefined constants into a pro file. I have a lot of code written for QT and I am trying to incorporate the source from OpenSCADA into my project. I have encountered some problems relating to prepossessing. In the OpenSCADA there are the following constants used throughout the code:
    PACKAGE
    PACKAGE_STRING
    PACKAGE_NAME
    VERSION

    I take it they are version control strings used for distribution. I have tried using "#define" statements in a .config file and "DEFINES+=" statements in the project file. An example of the error:

    "error: expected ‘;’ before ‘PACKAGE_NAME’"

    "  <title>" PACKAGE_NAME ": " + SYS->id() + "</title>\n"
    

    I have tried the defines as '#define PACKAGE_NAME "Test"' and '#define PACKAGE_NAME +"Test"+', what am I doing wrong?

    Thanks



  • @CrazyDave
    Note that double commander cannot find these constants anywhere in the OpenSCADA source other than inline in the code.


  • Lifetime Qt Champion

    Hi
    The #DEFINEs +=
    is the way to do it.

    maybe the errors was due to incorrect escaping ?

    https://stackoverflow.com/questions/3348711/add-a-define-to-qmake-with-a-value


Log in to reply