Configure qxt library under Windows - windows

I want to include into my Qt 4.8.1 project the Qxt 0.6.2 library.
I followed the steps from their user guide and at the end the library was installed in: C:\Qxt. I have added these two lines in my project .pro file:
CONFIG += qxt
QXT += core gui
and when i compile the following error appears:
error: cannot find -lQxtGuid
Also in C:\Qxt\doc no documentation was generated and the command assistant -addContentFile C:\libqxt\doc\html\qxt.dcf is not working nor the file qxt.dcf exists.
Edit 1: My problem was solved by selecting to use release libs from Qt compile options

Related

Qbs does not add Qt libraries when linking application

I installed VS2015 and QtCreator 3.5 and compiled Qt5.5 from source as a binary distribution is not available for the visual c++ compiler shipped with VS2015.
I tried to compile my project which was developed using the visual c++ compilers from VS2012/VS2013 and QtCreator 3.3x with Qt 5.2 and Qbs - on a different machine - from QtCreator and with my new setup neither QtCreator nor Qbs from command line are able to link the application.
I narrowed the problem down using the Qbs helloworld example
import qbs
CppApplication {
type: "application" // To suppress bundle generation on Mac
consoleApplication: true
files: "main.cpp"
Depends {
name: "Qt"
submodules: [
"core"
]
}
}
Which gives the following output when building with qbs from the command line
compiling main.cpp
linking halloqbswelt.exe
ERROR: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe /nologo /DEBUG /PDB:halloqbswelt.pdb /OSVERSION:5.02 /SUBSYSTEM:CONSOLE,5.02 /MANIFEST /MANIFESTFILE:D:\projekte\halloqbswelt\Qt5-debug\halloqbswelt.Qt5.842abbdf\intermediate.halloqbswelt.exe.manifest D:\projekte\halloqbswelt\Qt5-debug\halloqbswelt.Qt5.842abbdf\.obj\3a52ce780950d4d9\main.cpp.obj .lib /OUT:D:\projekte\halloqbswelt\Qt5-debug\halloqbswelt.Qt5.842abbdf\intermediate.halloqbswelt.exe /LIBPATH:D:\projekte\3rd_party\qt\qtbase\lib
LINK : fatal error LNK1104: cannot open file '.lib'
ERROR: Process failed with exit code 1104.
The following products could not be built for configuration Qt5-debug:
halloqbswelt
Rather cryptic so I'll highlight the problem from the above output
[...] .obj\3a52ce780950d4d9\main.cpp.obj .lib /OUT: [...]
So the empty .lib file is the problem.
Comparing the linker statement with that from the other machine, the empty .lib is at the same position where Qt5Core.lib should be.
Thus tried to investigate why Qbs does not resolve the paths proberly; I looked at the core.qbs module but couldn't find anything different from the file on the machine with the working setup.
Finally I decided to recompile the Qt library and setup the Qbs/QtCreator profiles from scratch. Done and it worked, until I restarted QtCreator, now neither (Qbs from command line, nor QtCreator with its own profile) works anymore.
Has somebody experienced such a behavior?
As said in the comment, http://article.gmane.org/gmane.comp.lib.qt.qbs/682 gave me the right starting point.
Qbs relies on pri/prl files of each submodule from which the dependencies are built (as far as I understood). These pri files are overwritten or some other bad stuff happens when installing Qt built from source in a non-prefix environment (which is the default under Windows) (https://bugreports.qt.io/browse/QTBUG-42959).
So building Qt with a prefix and installing the sources is solves the problem, at least for me.

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.

Parsing data using QJson on mac

I am working on Qt project. I have installed QJson successfully. And have used parser to parse the data.My code get compiled successfully but at run time it is giving me following error:
dyld: Library not loaded: libqjson.0.dylib
Referenced from: /Users/sanjay/untitled1-build-desktop-Qt_4_8_3_in_PATH_System_Debug/untitled1.app/Contents/MacOS/untitled1
Reason: image not found
I have added library as external library in Qt creater. It added following code to my .pro file:
macx: LIBS += -L$$PWD/../build/_preferred_path_/lib/ -lqjson
INCLUDEPATH += $$PWD/../build/_preferred_path_/include/qjson
DEPENDPATH += $$PWD/../build/_preferred_path_/include/qjson
Could anybody tell me please What am I doing wrong?
Make sure the library is located with your application's app file. Give full path names like LIBS += "lib/libqjson.dylib"
I used the above directive and it worked for me.
If your application compiles successfully then it means that project configuration defined in pro file is correct (including LIBS configuration).
In this case your application fails on runtime, so that means means that libqjson.0.dylib could not be found in library path. First check how json library is linked with your library using otool tool (http://tech-queries.blogspot.com/2011/04/dynamic-library-dependency-on-mac-os-x.html). This tool will help you to detect the problem, after detection you may:
copy libqjson.0.dylib in appropriate location
correct link using install_name_tool tool http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html
relinking of library step may be set as post build step in in pro file. Here is example:
macx {
QMAKE_POST_LINK = install_name_tool -change libqjson.0.dylib #loader_path/relative_path_to_library/libqjson.0.dylib your_binary_file
In Terminal, type this:
otool -L /Users/sanjay/untitled1-build-desktop-Qt_4_8_3_in_PATH_System_Debug/untitled1.app/Contents/MacOS/untitled1
It will tell you where each of the dependent libraries is expected to be.

linker error using qmake with boost thread in windows MSVC

I am using QtCreator on Windows with boost library. right now I am stuck with linking boost threading library against my Application.
In my C:\boost_1_47_0\bin.v2\libs\thread\build directory I see only msvc-10.0 no mingw So I need to choose MSVC2010 as My build configuration instead of mingw.
on compilation its reporting error: LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_47.lib'
I can find There is boost_thread-vc100-mt-gd-1_47.lib here in libs directory but no libboost_thread-vc100-mt-gd-1_47.lib (check the extra lib on left)
in my .pro
win32:INCLUDEPATH += C:\boost\include\boost-1_47
win32:CONFIG(debug): LIBS += C:\boost_1_47_0\bin.v2\libs\thread\build\msvc-10.0\debug\threading-multi\boost_thread-vc100-mt-gd-1_47.lib

how to deploy qt based application with oracle plugin

just wrote application based QT with OCI plugin but i can't deploy it.
i did the following steps:
installed QT 4.7 SDK
Installed the OCI plugin:
set INCLUDE=%INCLUDE%;c:\oracle\oci\include
set LIB=%LIB%;c:\oracle\oci\lib\msvc
cd %QTDIR%\src\plugins\sqldrivers\oci
qmake -o Makefile oci.pro
nmake
i followed: "Building static Qt on Windows with MSVC"
edited the \mkspecs\win32-X\qmake.conf:
QMAKE_CFLAGS_RELEASE = -O2 -MT
CONFIG += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target
then on the Qt dir:
configure -static -release
nmake sub-src
i'm not sure about the next steps but in my application dir i ran:
qmake -o Makefile myProgram.pro
nmake
i get .exe file in release but i get error that the OCI driver is not loaded...
please assist me ,
i had no errors in any step i made
Shouldn't you first compile your static version of Qt and then compile the OCI plugin? You could also do this in one step by setting the appropriate configure switch -qt-sql-oci and adding the required include and lib dirs.
Because, in your scenario, which qmake did you use to compile your OCI plugin? The static one you intend to use for your app isn't build yet. So it seems your OCI plugin was build with one Qt version, whereas your application uses another (static) Qt version. This mismatch is most probably the cause of your problem.
Also, when using static plugins, you have to use the Q_IMPORT_PLUGIN macro. See here for more details http://doc.qt.io/archives/qt-4.7/plugins-howto.html#static-plugins
As requested, here a step by step instruction how it should work:
Extract the qt sources for your static Qt version, lets say in C:\Qt\4.7.0-static
Change qmake.conf the way you already did.
In your visual studio command line, change directory to C:\Qt\4.7.0-static and do this:
configure -static -release -qt-sql-oci -I C:\oracle\oci\include -L c:\oracle\oci\lib\msvc
Do a nmake sub-src
Then, change the qt version you use for your app to the one just compiled and execute "Run qmake" and "Rebuild project" from the build menu in QtCreator (as you installed Qt SDK, I'm assuming you're using it)
It hopefully works now - using the -qt-sql-oci switch causes a static build of the oci driver.

Resources