LNK1104: cannot open file 'tomcryptd.lib' in QT creator - c++

So, I'm trying to run this example program in qt using the tomcrypt library and when I tried to build the project the compiler threw this error: LNK1104: cannot open file 'tomcryptd.lib', I added the tomcrypt library using the "Add library" interface and these are the contents of the .pro file:
QT -= gui
CONFIG += c++17 console
CONFIG -= app_bundle
#You can make your code fail to compile if it uses deprecated APIs.
#In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
TRANSLATIONS += \
ProjectM2_en_US.ts
CONFIG += lrelease
CONFIG += embed_translations
#Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../libraries/libtomcrypt/lib/ -ltomcrypt
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../libraries/libtomcrypt/lib/ -ltomcryptd
INCLUDEPATH += $$PWD/../../libraries/libtomcrypt/include
DEPENDPATH += $$PWD/../../libraries/libtomcrypt/include
I have tried searching for solutions but so far, I have not found one that worked for me. I'll be really thankful if anyone has a solution for my problem

Related

Why am i getting this error with using opencv on QT windows?

I am having this issue where I have installed OpenCV to be used on QT creator. I have typed some basic testing code "cv::Mat img = imread("test.png");" this does not compile as it gives me 4 errors that i have shown in the image.
------------------------.Pro File--------------------------------------
QT += core gui
QT += testlib
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has 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
# You can also make your code fail to compile if it uses 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 += \
editor.cpp \
image.cpp \
linked_list.cpp \
main.cpp \
mainwindow.cpp \
tests.cpp
HEADERS += \
editor.h \
image.h \
linked_list.h \
mainwindow.h \
node.h
FORMS += \
editor.ui \
mainwindow.ui
INCLUDEPATH += \
D:/boost
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
win32:CONFIG(release, debug|release): LIBS += -LD:/opencv/build/x64/vc15/lib/ -lopencv_world420
else:win32:CONFIG(debug, debug|release): LIBS += -LD:/opencv/build/x64/vc15/lib/ -lopencv_world420d
else:unix: LIBS += -LD:/opencv/build/x64/vc15/lib/ -lopencv_world420
INCLUDEPATH += D:/opencv/build/include
DEPENDPATH += D:/opencv/build/include

Can't use OSG with GDAL on Windows

I work on Windows 10 x64
IDE: QtCreator 4.8.0 Based on Qt 5.12.0 (MSVC 2015, 32 bit)
Content of my .pro file is at the very bottom if it's needed.
There is a minimal OSG sample (main.cpp):
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <ogrsf_frmts.h>
int main(int argc, char *argv[]) {
// OGRPoint p; //breakpoint 1
osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("../resourses/cessna.osg"); //breakpoint 2
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
return viewer.run();
}
In the code above you can see, where i set breakpoints.
So:
In case with commented OGRPoint p;:
It compiles, runs, stops on "breakpoint 2" and when i go forward it shows the airplane (model "cessna.osg"). This is correct behavior.
In case with uncommented OGRPoint p;:
It compiles, runs and ignore both breakpoints. It doesn't show anything. As if i had nothing in my main. If i do it on Linux, then it works fine. Why does it can happen?
.pro file, if it affects :
TEMPLATE = app
TARGET = hello
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
# any Qt feature that has 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
# You can also make your code fail to compile if it uses 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
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
#<--------------------- OSG Library
win32 {
OSG_LIB_DIRECTORY = $$(OSG_BIN)
OSG_INCLUDE_DIRECTORY = $$(OSG_INCLUDE)
CONFIG(debug, debug|release) {
TARGET = $$join(TARGET,,,_d)
LIBS += -L$$OSG_LIB_DIRECTORY -losgd
LIBS += -L$$OSG_LIB_DIRECTORY -losgViewerd
LIBS += -L$$OSG_LIB_DIRECTORY -losgDBd
LIBS += -L$$OSG_LIB_DIRECTORY -lOpenThreadsd
LIBS += -L$$OSG_LIB_DIRECTORY -losgUtild
LIBS += -L$$OSG_LIB_DIRECTORY -losgGAd
} else {
LIBS += -L$$OSG_LIB_DIRECTORY -losg
LIBS += -L$$OSG_LIB_DIRECTORY -losgViewer
LIBS += -L$$OSG_LIB_DIRECTORY -losgDB
LIBS += -L$$OSG_LIB_DIRECTORY -lOpenThreads
LIBS += -L$$OSG_LIB_DIRECTORY -losgUtil
LIBS += -L$$OSG_LIB_DIRECTORY -losgGA
}
INCLUDEPATH += $$OSG_INCLUDE_DIRECTORY
}
unix {
CONFIG(debug, debug|release) {
TARGET = $$join(TARGET,,,_d)
LIBS += -losgd
LIBS += -losgViewerd
LIBS += -losgDBd
LIBS += -lOpenThreadsd
} else {
LIBS += -losg
LIBS += -losgViewer
LIBS += -losgDB
LIBS += -lOpenThreads
}
}
#--------------------- OSG Library !>
HEADERS += $$OSG_INCLUDE_DIRECTORY
#<--------------------- GDAL Library
win32 {
INCLUDEPATH += D:/Interface/Work/Libs/gdal/include/
LIBS += D:/Interface/Work/Libs/gdal/lib/libgdal-20.dll
}
unix {
LIBS += -L/usr/local/lib -lgdal
}
#--------------------- GDAL Library !>
Problem was that the library needed libgdal-20.dll to work. I didn't specify the path to the .dll. So i resolved this problem by copiyng the .dll file into folder with binaries. Now it works fine.

Can't step into/break on my code with qt creator

I have created a project in qt creator with multiple subdirs and am deploying/running it on a beaglebone. Compiles fine, deploys fine, etc.
My issue is that when I try to debug, the only files I can set breakpoints in or step into are those in the same subdir where main.cpp is. Just to test, I duplicated the project with a flat folder structure and can set breakpoints and step into everything.
When the debugger starts up, the debug log tries to set the breakpoints and fails seemingly because it can't find the .cpp files:
"No source file named projectdir/dir1/myclass.cpp.\n"
8045^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="",pending="\"projectdir/dir1/myclass.cpp\":7",times="0",original-location="\"fullpathofprojectdir/dir1/myclass.cpp\":7"}
Whereas it says this for breakpoints in main:
8046^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0001831c",func="main(int, char**)",file="projectdir/dir2/main.cpp",fullname="fullpathofprojectdir/dir2/main.cpp",line="27",thread-groups=["i1"],times="0",original-location="fullpathofprojectdir/dir2/main.cpp:27"}
Additionally, myclass.cpp doesn't show up in the source files panes either. How can I resolve this?
Here is the setup of my *.pro files:
Top level project file:
TEMPLATE = subdirs
SUBDIRS += \
dir1 \
dir2
unix {
target.path = /home/debian
INSTALLS += target
}
Project file of library (dir1, myclass.cpp, etc):
QT -= gui
TARGET = Common
TEMPLATE = lib
DEFINES += COMMON_LIBRARY
SOURCES += \
myclass.cpp
HEADERS += \
common_global.h \
myclass.h
unix {
target.path = /home/debian/lib
INSTALLS += target
}
CONFIG += debug
Project file containing main:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Test
TEMPLATE = app
SOURCES += \
main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Common/release/
-lCommon
else:win32:CONFIG(debug, debug|release): LIBS += -
L$$OUT_PWD/../Common/debug/ -lCommon
else:unix: LIBS += -L$$OUT_PWD/../Common/ -lCommon
INCLUDEPATH += $$PWD/../Common
DEPENDPATH += $$PWD/../Common
target.path = /home/debian
INSTALLS += target
Let me know if there's any other relevant data I forgot to provide. Qt Creator version is 4.5.0 and I'm running it on a 64 bit VM of ubuntu 16.04 if that's relevant.

How to setup libusb with Qt on Mac Os X? (trying a cross-platform approach)

I'm triying to setup "libusb" on Qt 4.2.1 (Qt Creator 5.8) QML proyect. I really want to understand what to do after downloading the Lib, i have all the files but i don't know if i have to installed them on my system first or use them by just link them (btw, couldn't do it).
My .pro file goes like this:
QT += qml quick
QT += core gui
CONFIG += c++11
SOURCES += main.cpp
HEADERS += libusb-1.0.21/libusb/libusb.h
INCLUDEPATH +=/usr/local/include/libusb-1.0
LIBS += -L/usr/local/lib -lusb-1.0
RESOURCES += qml.qrc
QML_IMPORT_PATH =
QML_DESIGNER_IMPORT_PATH =
DEFINES += QT_DEPRECATED_WARNINGS
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES +=
It 'd be really helpful if someone could explained how is the process of installing, including libs.
My App targets Desktop and Cross-Platform (Linux, Windows, MacOs)
You should check a package manager like Homebrew to install these kind of libraries. It the easiest way in my opinion. You could also consider installing pkgconfig via this tool. With both the qmake should have something like this if I'm not mistaken:
CONFIG += link_pkgconfig
PKGCONFIG += libusb-1.0

/usr/include/libfreenect.hpp:33: error: libusb.h: No such file or directory

I installed libfreenect. I opened QT and began to coding. When I use libfreenect.h no error occurres. But when I use libfreenect.hpp, this error occurred:"error: libusb.h: No such file or directory"
contents of .pro file is:
QT += core
QT -= gui
CONFIG += c++11
TARGET = 12moharram
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../usr/local/lib/release/ -lfreenect
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../usr/local/lib/debug/ -lfreenect
else:unix: LIBS += -L$$PWD/../../../usr/local/lib/ -lfreenect
INCLUDEPATH += $$PWD/../../../usr/local/include
DEPENDPATH += $$PWD/../../../usr/local/include
Where is the problem?
Probably libfreenect.h and libfreenect.hpp are themselves including other files, for a reason that I cannot understand libfreenect.hpp is including libusb.h and libfreenect.h is not. Probably libusb.h is not in your INCLUDEPATH.
I would first try to find libusb.h, if it is not present install it (you will probably have to install libusb-dev (debian style). Once you are sure libsub.h is present make sure is in the INCLUDEPATH, in case change the INCLUDEPATH in your .pro file.
This should fix this specific problem but after you fix this there can be more, good luck.