Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. LITERAL_HASH and system() [solved]

LITERAL_HASH and system() [solved]

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Lindley
    wrote on last edited by
    #1

    I'm trying to have qmake generate a header file for me that has some #include statements in it. To do this, I'm using a command of the form:

    system(echo $${LITERAL_HASH}include "blahblah.h")

    I was very confused why this wasn't working. After playing around with it for a while, I've noticed that if you do the following:
    [code]
    mystring = "Hello, $${LITERAL_HASH}Goodbye."
    message($$mystring)
    system(echo $$mystring)
    [/code]
    then qmake will output:
    [quote]
    Project MESSAGE: Hello, #Goodbye
    Hello,
    [/quote]

    In other words, the entire string is printed to message(), but it is cut off at the hash sign in system(). This seems to me like a bug. Any ideas on a workaround?

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

      Hi,

      @system(echo "Hello, \$${LITERAL_HASH}Goodbye.")@

      starts a comment for bash so it's no executed

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lindley
        wrote on last edited by
        #3

        Ah---that's what I get for testing in csh.

        Surrounding the echo arguments with single quotes appears to have solved it.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Good, since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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