Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. isEmpty() does not work with a variable

isEmpty() does not work with a variable

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 493 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Besajia
    wrote on last edited by
    #1

    Hi, I have a file lib_template.pri

    
    isEmpty(NAME)
    {
            error(NAME must be set before including the file)
    }
    
    TEMPLATE = lib
    CONFIG += static
    
    TARGET = $$NAME
    
    INCLUDEPATH += \
            $$PWD \
    
    

    it is supposed to be used in the manner

    NAME = lib_name
    include($$qmake_scripts_dir/lib_template.pri)
    

    isEmpty(...) always shows error as if NAME never defined
    What is the problem?

    https://ubego.ru

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      QMake scope rules is a bit surprising at times.

      try the test as

      isEmpty(NAME) { error(NAME must be set before including the file) }
      (as a one liner )

      aha_1980A 1 Reply Last reply
      5
      • mrjjM mrjj

        Hi
        QMake scope rules is a bit surprising at times.

        try the test as

        isEmpty(NAME) { error(NAME must be set before including the file) }
        (as a one liner )

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @mrjj at least the opening brace needs to be on the same line ;)

        Qt has to stay free or it will die.

        mrjjM 1 Reply Last reply
        3
        • aha_1980A aha_1980

          @mrjj at least the opening brace needs to be on the same line ;)

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @aha_1980
          yeah, i regularly forget that - as they cleverly made it look like a normal scope { }
          but with the twist that first { must be on the same line. 😂

          1 Reply Last reply
          1
          • B Offline
            B Offline
            Besajia
            wrote on last edited by
            #5

            thank you. However it is not intuitive for C++ programmer....

            https://ubego.ru

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved