Qt6 topics merged with General

LITERAL_HASH and system() [solved]

  • 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:
    mystring = "Hello, $${LITERAL_HASH}Goodbye."
    system(echo $$mystring)
    then qmake will output:
    Project MESSAGE: Hello, #Goodbye

    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?

  • Lifetime Qt Champion


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

    starts a comment for bash so it's no executed

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

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

  • Lifetime Qt Champion

    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 :)

Log in to reply