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. link flag order error
Forum Updated to NodeBB v4.3 + New Features

link flag order error

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 707 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.
  • SolarWindStormS Offline
    SolarWindStormS Offline
    SolarWindStorm
    wrote on last edited by
    #1

    Hello:

    I am using qmake 4.7.4.

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

    Here are some of my current prog.pro flags:

    TEMPLATE = app
    TARGET = prog
    MAKEFILE = make_prog
    QMAKE_CFLAGS += -ansi -std=c99 -DTOOL_FAMILY=gnu -DTOOL=gnu $$INCLUDEPATH
    HOME_DIR = $$(PWD)
    SRC_DIR = $$HOME_DIR/
    CONFIG = build_all x11 staticlib
    DESTDIR = linux
    OBJECTS_DIR = $$DESTDIR/obj
    DEFINES += LINUX_BUILD
    QMAKE_LFLAGS = -Wl

    (include and lib stuff excluded for brevity)

    SOURCES = $$SRC_DIR/prog.c

    And here is the current qmake output in a makefile:

    $(TARGET): $(OBJECTS)
    @$(CHK_DIR_EXISTS) linux/ || $(MKDIR) linux/
    $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

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

    $(TARGET): $(OBJECTS)
    @$(CHK_DIR_EXISTS) linux/ || $(MKDIR) linux/
    $(LINK) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) $(LFLAGS)

    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 prog.pro 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?

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

      Hi and welcome to devnet,

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

      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
      • SolarWindStormS Offline
        SolarWindStormS Offline
        SolarWindStorm
        wrote on last edited by
        #3

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

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

          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

          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