Important: Please read the Qt Code of Conduct -

[solved] QMAKE: unknown replace function...

  • Hi guys, I am here again, now I am learning QMAKE from QtCreator Git Clone and I am trying to use that directory structure, everything works fine but:
    I have got Project.pri file where is defined function:
    @defineReplace(getLibraryTarget) { return($${PROJECT_NAME}.$$1) }@
    And it should replace library target in library subproject (Project.pri is included there) to: Project.LibraryName
    But: If I run that project, QMAKE writes: @"Unknown replace function: getLibraryTarget"@

    In library project is:
    QT += xml xmlpatterns gui

    TARGET = $$getLibraryTarget(ServicesManager)
    TEMPLATE = lib


    SOURCES += ServicesManager.cpp

    HEADERS += ServicesManager.h

    I really don't know where is the problem.

    EDIT: I tried to define another function in Project.pri, but the same problem result: unknown function... I don't know where is the problem...But when I wrote message($${PROJECT_NAME}), that variable was found and wrote the "Project" .. I really don't understand it...

  • I think qmake is pretty strict in the function formatting. See if it helps if you no longer make it a one-liner:

    @defineReplace(getLibraryTarget) {

  • Well, I rewrote it...Probably .pri file was missing (but it was there!)... And then it worked fine... thanks for help and time :)

Log in to reply