link flag order error

  • Hello:

    I am using qmake 4.7.4.

    I am trying to figure out how to set up my file so that it will fix a link error.

    Here are some of my current flags:

    TEMPLATE = app
    TARGET = prog
    MAKEFILE = make_prog
    QMAKE_CFLAGS += -ansi -std=c99 -DTOOL_FAMILY=gnu -DTOOL=gnu $$INCLUDEPATH
    HOME_DIR = $$(PWD)
    CONFIG = build_all x11 staticlib
    DESTDIR = linux

    (include and lib stuff excluded for brevity)

    SOURCES = $$SRC_DIR/prog.c

    And here is the current qmake output in a makefile:

    @$(CHK_DIR_EXISTS) linux/ || $(MKDIR) linux/

    ... only this fails at link time.

    I can get prog to link by moving the "$(LFLAGS)" statement to the end of the line so that it looks like this:

    @$(CHK_DIR_EXISTS) linux/ || $(MKDIR) linux/

    I am not saying one way is right over the other, but assuming what I want is not totally insane, what do I have to include in my file to make the flag ordering fit my needs?

    Maybe I am missing something obvious as I read through the various qmake man pages. Thoughts?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The thing is: you don't pass any flags. Wl should be followed by a linker flag.

  • I removed -Wl from QMAKE_LFLAGS (it was not supposed to be there anyways). no difference.

  • Lifetime Qt Champion

    Re-reading your .pro file content, I just saw that you replace the content of CONFIG which is a bad idea.

    If you don't want your project to be linked with Qt just add CONFIG -= qt

Log in to reply

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