QTCreator and windows resource files.
-
wrote on 25 Feb 2015, 00:29 last edited by
Really, this post should be about qmake.
TEMPLATE = app
CONFIG -= console
CONFIG += windows
CONFIG += staticlib
CONFIG += static
CONFIG -= app_bundle
CONFIG -= qtRC_FILE = resource.rc
QMAKE_CXXFLAGS += -std=c++11 -s -mwindows -municode -o WinTest.exe
QMAKE_LFLAGS += -static -o release\resource_res.o
LIBS += -lgdi32 -lcomctl32SOURCES += wintest.cpp
main.cpp
HEADERS +=
WinTest.h
resource.hDISTFILES +=
WinTest.exe.manifest
resource.rcfails 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?
-
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 -
wrote on 25 Feb 2015, 12:23 last edited by
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 ?
-
Might be, yes indeed !
4/4