qmake不生成二进制资源文件 [英] qmake not generating binary resource files
问题描述
规格:Qt Creator 2.5.1,Qt 4.7.4(32位)
Specs: Qt Creator 2.5.1, Qt 4.7.4(32bit)
根据我对 Qt文档的理解,其中包括资源Qt的.pro文件中的(.qrc)是获取qmake生成正确的qrc _ *.cpp文件所需的全部.我的项目似乎并非如此.运行qmake时,将创建make文件,并且在我正在编译器_rcc_clean下找到要查找的qrc_文件的引用,而不仅仅是在构建链中.
It is my understanding from the Qt documentation that including a resource (.qrc) in the .pro file of Qt is all that is required to get qmake to generate the correct qrc_*.cpp files. That doesn't seem to be the case for my project. When running qmake the makes files are created and there are references to the qrc_ file I'm looking for under compiler_rcc_clean, just not in the build chain.
[更新] 根据下面注释的建议,由qmake生成的makefile已直接通过NMAKE测试.正确的qrc_filter_ao.cpp文件已创建.但是,当我从Qt Creator进行构建时,IDE仍无法正确生成此文件.
[Update] At a suggestion from comments below the makefile generated by qmake was tested directly w/ NMAKE. The correct qrc_filter_ao.cpp file was created. However the IDE still fails to properly generate this file when I build from Qt Creator.
.pro:
include (../../shared.pri)
TARGET = filter_ao
QT += opengl
HEADERS += ./filter_ao.h
SOURCES += ./filter_ao.cpp
RESOURCES += \
filter_ao.qrc
shared.pri
shared.pri
include (./general.pri)
VCGDIR = ../$$VCGDIR
TEMPLATE = lib
CONFIG += plugin
CONFIG += resources
QT += opengl
QT += xml
QT += xmlpatterns
QT += script
win32-msvc2008: LIBS += ../../distrib/common.lib
win32-msvc2008:DEFINES += GLEW_STATIC _USE_MATH_DEFINES
INCLUDEPATH *= ../.. $$VCGDIR ../$$GLEWDIR/include
DEPENDPATH += ../.. $$VCGDIR
win32-msvc2008:DEFINES += _CRT_SECURE_NO_DEPRECATE
CONFIG(release,debug | release){
# Uncomment the following line to disable assert in mingw
#DEFINES += NDEBUG
}
DESTDIR = ../../distrib/plugins
contains(TEMPLATE,lib) {
CONFIG(debug, debug|release) {
unix:TARGET = $$member(TARGET, 0)_debug
else:TARGET = $$member(TARGET, 0)d
}
}
win32-msvc2008: RCC_DIR = $(ConfigurationName)
general.pri
general.pri
VCGDIR = ../../../vcglib
GLEWDIR = ../external/glew-1.7.0
win32:DEFINES += NOMINMAX
推荐答案
我认为@Pie_Jesu是正确的.我已经使用OP中的文件建立了目录结构,并将.pro文件导入到QtCreator中.由于我使用的是VS Express 2010,因此已从设置RCC_DIR的行中删除了"win32-msvc2008:"前缀. 结果是我收到类似无法打开\ qrc_filter_ao.cpp进行写入:访问被拒绝"之类的消息,并且未创建任何qrc_file. 然后,将行设置为/TEMP:
I think @Pie_Jesu is correct. I have set up a directory structure with the files from the OP, and imported the .pro file into QtCreator. I have removed the "win32-msvc2008: " prefix from the line which sets RCC_DIR since I am using VS Express 2010. Result was that I get a message like "Unable to open \qrc_filter_ao.cpp for writing: Access denied" and no qrc_file is being created. I then set the line to /TEMP:
RCC_DIR = /TEMP
结果是我在\ TEMP下面找到了qrc_文件.
Result is that I find the qrc_ file below \TEMP.
这篇关于qmake不生成二进制资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!