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. QTCreator and windows resource files.
Forum Update on Monday, May 27th 2025

QTCreator and windows resource files.

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.5k Views
  • 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.
  • J Offline
    J Offline
    jcoder187
    wrote on 25 Feb 2015, 00:29 last edited by
    #1

    Really, this post should be about qmake.

    TEMPLATE = app
    CONFIG -= console
    CONFIG += windows
    CONFIG += staticlib
    CONFIG += static
    CONFIG -= app_bundle
    CONFIG -= qt

    RC_FILE = resource.rc
    QMAKE_CXXFLAGS += -std=c++11 -s -mwindows -municode -o WinTest.exe
    QMAKE_LFLAGS += -static -o release\resource_res.o
    LIBS += -lgdi32 -lcomctl32

    SOURCES += wintest.cpp
    main.cpp
    HEADERS +=
    WinTest.h
    resource.h

    DISTFILES +=
    WinTest.exe.manifest
    resource.rc

    fails to build, with :

    windres -i ..\WinTest\resource.rc -o C:\Users\Johnathon\Documents\WinTest\debug\resource_res.o --include-dir=./../WinTest -DUNICODE -DQT_NEEDS_QMAIN
    windres: C:\Users\Johnathon\Documents\WinTest\debug\resource_res.o: No such file or directory
    Makefile.Debug:83: recipe for target 'C:/Users/Johnathon/Documents/WinTest/debug/resource_res.o' failed
    mingw32-make[1]: *** [C:/Users/Johnathon/Documents/WinTest/debug/resource_res.o] Error 1
    mingw32-make[1]: Leaving directory 'C:/Users/Johnathon/Documents/build-WinTest-MinGW64-Debug'
    mingw32-make: *** [debug] Error 2
    makefile:34: recipe for target 'debug' failed
    17:50:48: The process "C:\MinGW\mingw64\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project WinTest (kit: MinGW64)
    When executing step "Make"

    The problem is the call to windres is incorrect.

    windres -i ....\WinTest\resource.rc -o C:\Users\Johnathon\Documents\build-WinTest-MinGW64-Debug\debug\resource_res.o

    because make enters C:\Users\Johnathon\Documents\build-WinTest-MinGW64-Debug\debug before calling windres.

    the paths need an extra ..\

    is there a workaround for this, other than hand editing the makefiles?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Feb 2015, 01:09 last edited by
      #2

      Hi,

      @
      QMAKE_CXXFLAGS = -std=c+11 -s -mwindows -municode -o WinTest.exe
      QMAKE_LFLAGS += -static -o release\resource_res.o
      @

      These two are fishy

      @
      CONFIG += c++11 static
      @
      will enable the C++11 and static build of the application
      The -o part should not be there at all

      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
      • J Offline
        J Offline
        jcoder187
        wrote on 25 Feb 2015, 12:23 last edited by
        #3

        Such a simple oversight, Sometimes it's better to have someone else look. Ty for your reply.

        QMAKE_LFLAGS is used during linking. -static will statically link the object files along with the libraries. I was unaware of CONFIG += c++11, silly me.

        QMAKE_CXXFLAGS is used during compiling, -std=c++11 is acceptable, the -o however, not, the compiler ignores it though, and produces the object file.

        the actual problem, is here
        *
        windres -i ..\WinTest\resource.rc -o C:\Users\Johnathon\Documents\WinTest\debug\resource_res.o —include-dir=./../WinTest -DUNICODE -DQT_NEEDS_QMAIN
        windres: C:\Users\Johnathon\Documents\WinTest\debug\resource_res.o: No such file or directory
        Makefile.Debug:83: recipe for target ‘C:/Users/Johnathon/Documents/WinTest/debug/resource_res.o’ failed*

        make is starting in the object file directory, then calling windres from that directory. The path passed to windres for the target file needs to be ....\WinTest\resource.rc

        I confirmed this at the shell.

        Now, with all that said...

        Do you think it's possible the QMAKE_CXXFLAGS erroneous -o could and would cause qmake to bugger the call to windres ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 25 Feb 2015, 23:11 last edited by
          #4

          Might be, yes indeed !

          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

          4/4

          25 Feb 2015, 23:11

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved