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:
    [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?


  • Lifetime Qt Champion

    Hi,

    @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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.