$$PWD no longer working in Qt Creator 2.6 - windows

I have a project (https://github.com/waddlesplash/qtfastjson) that has a .pri file that uses qmake's $$PWD variable. This works fine in all tested versions of qmake, but in Qt Creator 2.6, the files are not displayed in the project tree (but it compiles properly).
Here's the PRI:
QT += core
INCLUDEPATH += $$PWD
HEADERS += $$PWD/QtFastJson.h \
$$PWD/QtFastJsonObject.h
SOURCES += $$PWD/QtFastJson.cpp \
$$PWD/QtFastJsonObject.cpp
which is included from a .pro: include(../src/QtFastJson.pri).
If the $$PWD variables are removed and replaced with relative paths, the files show in the tree.

It seems to work for me in Qt Creator 2.6. Try to place a log immediately before appending to the HEADERS variable:
message($$PWD)
Then check if that path really contains the files you're adding.
Also you can try with the _PRO_FILE_PWD_ variable.

Related

Lupdate doesn't work

I'm trying to run lupdate on my .pro file and this is what I see. Nothing happens next and .ts files aren't created. My OS is Win10 as seen from picture. I'm using Qt 5.10.1 with MinGW. Also I've tried to run lupdate on Ubuntu 16.04 and it seems that it works properly. Can somebody please help me with this issue?
QT += quick
QT += quickcontrols2
CONFIG += c++11
CONFIG += console
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS QT_MESSAGELOGCONTEXT
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp \
shoppinglistmodel.cpp \
loggingcategories.cpp \
logger.cpp \
purchase.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
shoppinglistmodel.h \
loggingcategories.h \
logger.h \
purchase.h
INCLUDEPATH += "C:\boost_1_66_0"
DISTFILES +=
TRANSLATIONS = sh_lst_ru.ts \
sh_lst_ua.ts
Solution: It seems that if you are using boost libraries in project that should be translated you have to involve TR_EXCLUDE option in your .pro file.
Here's the one from mine, maybe it will help somebody:
TR_EXCLUDE = C:\boost_1_66_0\*

Qt Creator - LNK1104: cannot open file "glu32.lib"

I am using Qt and Qt Creator and I want to run a test file to see if my Installation is correct or not. I use Windows 8.1 64 bit. I installed the newest Qt OpenGL 64 bit Version for Windows.
I already included the file glu32.lib by doing this in my .pro file:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/C:/Program Files (x86)/Windows
Kits/8.1/Lib/winv6.3/um/x64/ -lGlU32
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x64/ -lGlU32d
INCLUDEPATH += $$PWD/C:/Program Files (x86)/Windows Kits/8.1/Include/um/gl
DEPENDPATH += $$PWD/C:/Program Files (x86)/Windows Kits/8.1/Include/um/gl
That did not fix it. The file exists in that Folder. Can you help me please?
First of all, it is case sensitive.
Secondly, you do not need to add the debug marker explicitly, so just write this:
LIBS += glu32
rather than:
LIBS += Glu32d
Also, as Martin pointed out in a comment, you better double quote strings containing spaces as follows:
-L"$$PWD/C:/Program Files (x86)/Windows"
or this if you fancy:
-L$$quote($$PWD/C:/Program Files (x86)/Windows)
Furthermore, this does not make any sense as the second branch will never satisfy:
win32: ...
else: win32: ...
If you do not want to go editing the project file, you can use the QtCreator GUI to add a system library like glu:
Furthermore, you seem to have 64 bit Qt installed on Windows, but you are trying to use 32 bit glu. Do not do that. Use either 32 bit for both or 64 bit.
Add
QMAKE_LIBDIR += "glu32_location"
to your .pro file, then it works.
When you make a project, at the kit selection, only select:
Desktop Qt 5.4.1 64bit
I had the same problem, then I made a new project without the 32 bit OpenGL Kit selected and it works fine for me. By default, Qt has both selected.
I know the question is about the QtCreator IDE, but I got this error when compiling from the command line. I had to run vcvars32.bat to fix it. Everything compiled fine because the msvc compiler was already in PATH, but linking was the problem.

qmake not finding opencv package when built from within Qt creator

I am fairly new to the Qt environment and I am running into an error when I try to build. I am also new to StackOverflow so pardon me if I miss format. When I run qmake from the command line it finds the opencv package and generates a Makefile, however when I run it from Qt Creator, it fails to find OpenCV.
Here is my .pro file
#-------------------------------------------------
#
# Project created by QtCreator 2013-03-24T21:23:01
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = cvtest
CONFIG += console
CONFIG -= app_bundle
CONFIG+=link_pkgconfig
PKGCONFIG+=opencv
TEMPLATE = app
SOURCES += main.cpp
I think it has to do with fully qualifying the path to qmake.
If I run
qmake /Users/matt/untitled1/untitled1.pro -r -spec macx-g++ CONFIG+=x86_64
on the command line it works fine, however if I fully qualify the path to qmake in the manner that Qt Creator does it;
/Users/matt/Qt5.0.0/5.0.0/clang_64/bin/qmake /Users/matt/untitled1/untitled1.pro
I get the following error:
Project ERROR: Package opencv not found
Any ideas on how to make this work in Qt Creator without going to the command line?
Try adding this to your .pro file:
QT_CONFIG -= no-pkg-config
I believe Qt for the Mac is built with the --no-pkg-config configure option.

OpenCV 2.4 : problems with includes in Qt in windows

I am not a C++ master (far from that actually), I try to setup an OpenCV + Qt project. I have downloaded the last release of OpenCV. I did nothing more with that (if I understand well, everything is pre-built, so I just have to add the path to the libs in my .pro file).
I added the path to the include folder /opencv/include
That should work that way, since the includes in cv.h, for example, are like that :
include "opencv2/core/core_c.h"
However, when I browse through my opencv folder, opencv2 is empty, there is no core folder in it, nor anything else, actually there is just a header file, opencv.h .
I noticed that all my include are spread into several folders, under the module folder... what should I do??
Thank you very much!
You have to add those libraries in .pro file module wise, means you have to add all modules you are using in the project to LIBS variable in .pro file. Say if you are using modules libopencv1, libopencv2, libopencv3
LIBS += -L/usr/lib -lopencv1 -lopencv2 -lopencv3
like that.
If opencv libraries are added to /usr/local/lib, use -L/usr/local/lib instead of -L/usr/lib
Here is my .pro file :
QT += core gui
TARGET = test_MTI880
TEMPLATE = app
SOURCES += ... ... ...
INCLUDEPATH += D:/PointGreyResearch/FlyCapture2/include \
+= D:/opencv/include
LIBS += D:/opencv/build/x86/vc10/lib/opencv_core240.lib \
D:/opencv/build/x86/vc10/lib/opencv_highgui240.lib \
D:/opencv/build/x86/vc10/lib/opencv_imgproc240.lib \
D:/opencv/build/x86/vc10/lib/opencv_objdetect240.lib \
D:/PointGreyResearch/FlyCapture2/lib/FlyCapture2.lib \
D:/PointGreyResearch/FlyCapture2/lib/C/FlyCapture2_C.lib \
D:/PointGreyResearch/FlyCapture2/lib/FlyCapture2d.lib \
D:/PointGreyResearch/FlyCapture2/lib/FC1/PGRFlyCapture.lib
OK I found the answer...
The right include folder is the one into the build folder ... -_-'

How can I force qtcreator to create non-universal binaries

When I use qtcreator on mac, it creates universal binaries.
Does anyone know how to set it so it just creates a 'native' binary? (So i386' in my case?)
Qtcreator uses qmake as a buildsystem.
Google hasn't been my friend so far, I hope stackoverflow will.
EDIT:
my config file so far:
TARGET = mongowriter
CONFIG += console
CONFIG -= app_bundle
CONFIG += x86
#CONFIG -= ppc
TEMPLATE = app
INCLUDEPATH += /opt/local/include/.
INCLUDEPATH += ../mongodb/.
SOURCES += main.cpp
LIBS += /usr/local/lib/libmongoclient.a
LIBS += /opt/local/lib/libboost_thread-mt.a
LIBS += /opt/local/lib/libboost_filesystem.a
LIBS += /opt/local/lib/libboost_program_options.a
It still gives the error on the libmongoclient.a
The libboost libraries are all ok, but this is because I got them from macports with the +universal option.
Since mongoclient doesn't support universal I'm currently removing all the universal stuff. I was hoping to get 3 errors for the boost libs and that at l;east mongoclient would link.
At that point I could redo the whole macport story again but this time with universal removed.
Unfortunately it seems it still builds a universal binary since I still have the same linker errors.
thanks for the help
you can use the 'CONFIG' variable in your project file to specify which plattforms shall be supported to create a universial binary you use
CONFIG += x86 ppc
if you only need x86 you use
CONFIG += x86

Resources