How to use QtCreator to statically link FLTK libraries - qt-creator

I am using Qt Creator (Qt 5.0.3 on Ubuntu 14) for a normal c++ project where I am using FLTK libraries. i want to link FLTK statically to my executable. How do I do that using Qt Creator( I am not using any of Qt libraries, just a normal c++ project with FLTK)

You can add suitable LIBS += -l... and INCLUDEPATH += /usr/... to your .pro

Related

how to add compile for QtCreator on Fedora?

Qt Creator Kits Option
Qt Creator Compilers
Qt Versions: 5.5 x86.i have added QTDIR to PATH.Qt Creator cannot detect GCC?

OpenCV libraries not found in Qt5 on OSX 10.10

I am currently trying to use OpenCV in a Qt project. When I build it, i get the error:
error: 'opencv2/opencv.hpp' file not found
#include <opencv2/opencv.hpp>
I know that there are many similar questions out there in the web, but none of the answers was actually able to fix my problem so far.
My specifications:
Qt 5.4.0 (Clang 6.0 (Apple), 64 bit)
Mac OSX 10.10.1
OpenCV 2.4.9 installed from homebrew
My .pro file looks like this:
QT += core gui multimedia multimediawidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MainProject
TEMPLATE = app
SOURCES += main.cpp mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /usr/local/include/opencv2
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
LIBS += -lopencv_ml
LIBS += -lopencv_video
LIBS += -lopencv_features2d
LIBS += -lopencv_calib3d
LIBS += -lopencv_objdetect
LIBS += -lopencv_contrib
LIBS += -lopencv_legacy
LIBS += -lopencv_flann
I made sure the links actually link to the right locations. All the header files and all the .dylib files are there as well. I checked the type of the libraries:
$ file libopencv_core.dylib
libopencv_core.dylib: Mach-O 64-bit dynamically linked shared library x86_64
In my project settings, the qmake command is:
qmake: qmake MainProject.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64
Unfortunately I only have a basic understanding of these compile-things, so I am not too sure, whether it has something to do with clang? I read something about clang behaving somehow different on OSX 10.10 Yosemite, but I did not completely understand why. Info about my clang:
$ clang --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
I also tried to use the gcc-kit in Qt (GCC x86 64bit in /usr/bin), but this messed up a lot more, which I did not understand.
Does somebody have an idea what I am doing wrong? Any help appreciated!
Patrick
You are already including the directory opencv2 in your #include statement. You should change your include path to just INCLUDEPATH += /usr/local/include.

Can't use C++11 features when building with Qt

I'm on OS X 10.8.4 (Mountain Lion) with the latest command line tools from Xcode. I'm trying to build a Qt project (in Qt Creator) which uses some C++11 features; notably std::unique_ptr. Whenever I try building though, I get the following error:
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
My .pro file is as follows:
QT += core gui
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++
LIBS += -mmacosx-version-min=10.7 -stdlib=libc++
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = APPNAME
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
cache()
I've tried the solutions presented in other answers (see here and the top answer here), neither of which seemed to work.
According to this site add
CONFIG += c++11
to your .pro file (see at the bottom of that web page). It requires Qt 5.
UPDATE: As for Qt 4, see How to enable C++11 in Qt Creator?

Compiling google test framework with Mingw compiler

I have a Qt project and i wanted to use google tests framework GoogleTestFramework in order to do google test. The framework compiled fine on Linux.
I have managed to compile the libraries on windows, using tips provided in the following link:
Installing Gtest without pthreads
The following advice do not let me compile the libraries, because of errors due to pthreads:
Sackoverflow compiling with MSYS
I have :
GNU Make 3.81 for make.exe
GNU Make 3.82 for mingw32-make
CMake 2.8.7
QT 4.7.4
Qt MingW gcc v 4.4.0
When i try to compile my test projet, i get an error saying:
undefined reference to '__chkstk_ms'
File not found: gtest-all.cc
Here is my qmake project code (I have semplified the code).
QT += core gui
DEPENDPATH += . headers src ../FastTrans/headers ../FastTrans/src ../FastTrans/forms C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/include
INCLUDEPATH += . headers src ../FastTrans/headers ../FastTrans/src ../FastTrans/forms C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/include
TARGET = tstall
#CONFIG += console
#CONFIG -= app_bundle
TEMPLATE = app
HEADERS += ../FastTrans/headers/shortcutsactionsitem.h \
../FastTrans/headers/shortcutsactionsmodel.h \
../FastTrans/headers/isavesettings.h
SOURCES += ../FastTrans/src/shortcutsactionsitem.cpp \
../FastTrans/src/shortcutsactionsmodel.cpp \
../FastTrans/src/isavesettings.cpp \
src/tstshortcutsactionsitem.cpp \
src/tstshortcutsactionmodel.cpp
INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/
win32: LIBS += C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/mybuid/libgtest.a
win32: LIBS += C:/MinGW/msys/1.0/home/zakharan/gtest-1.6.0/mybuid/libgtest_main.a
Google recommends the following for compiling in Windows:
### Windows Requirements ###
* Microsoft Visual C++ 7.1 or newer
### Cygwin Requirements ###
* Cygwin 1.5.25-14 or newer
I've heard of some people using MingW for compiling this. Supposedly compiling with MingW can be a little faster because there doesn't need to be a comparability layer between the OS and the application.
But, since this is just for dev testing purposes Cygwin should suffice. Just download the version that Google recommends.
See Also:
Compile Cygwin project in Eclipse
How Cygwin compares to MingW for porting Linux applications to Windows

QT + CUDA setting qmake.pro file

I'm trying to do a simple Qt + Cuda framework with an Helloworld.cu example. It is the simplest Qt ever. I'm trying to create the project file using a .pro file. My setup is windows 7, Qt 4.7.4 and Cuda toolkit + SDK (last version). Everything for Qt is working. What is not working is the Cuda part of the code, and that's probably because there is something missing in the .pro file...is there a simple paste/copy i could use for cuda in my .pro file? thanks
Take a look at http://cudaspace.wordpress.com/2011/04/07/qt-creator-cuda-linux/
You must adjust
# Path to cuda SDK install
CUDA_SDK = /pathto/NVIDIA_GPU_Computing_SDK/C (note i'm using a linux machine)
# Path to cuda toolkit install
CUDA_DIR = /usr/local/cuda
# libs - note than i'm using a x_86_64 machine
LIBS += -lcudart -lcutil_x86_64
with your CUDA SDK, CUDA Toolkit directories under windows and the name of the LIBS.
Maybe you will need to adjust the architecture m32 or m64 for 32 and 64 bits.
Hope this help.

Resources