I have Qt Creator 2.6.1 based on Qt 5.0
I have build cryptlib with visual studio 2010
all cryptlib project is on C:\SDK\cl342
when I have built the project the crypt.h and cl32.lib and cl32.dll are in this folder
C:\SDK\cl342
I am getting linker error on every method that I call from cryptlib such as cryptInit
I have tried adding it from the project menu and add external library it makes many changes to pro file but does not even let me include crypt.h.
mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cryptEnd#0 referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow##QAE#PAVQWidget###Z) –
my pro files looks something like this.
**QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testlistview
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH = C:\SDK\cl342\
DEPENDPATH += C:\SDK\cl342\
LIBS += C:\SDK\cl342\cl32.lib**
Related
I'm having an error when I integer libarchive in Qt 5.14.2. I'm on windows.
This is the error:
undefined reference to `archive_read_new'
In my main.cpp file, I have:
struct archive *a;
a = archive_read_new();
I compile sucessfully libarchive 3.4.2 with mingw64 but I'm having trouble to integer it in Qt.
In my libarchive folder I have:
include (containing archive.h & archive_entry.h)
lib (containing libarchive.dll.a & libarchive.dll)
In my .pro file:
INCLUDEPATH += "path\libarchive\include"
DEPENDPATH += "path\libarchive\include"
LIBS += -Lpath\libarchive\lib -larchive
But still, there is some thing I'm missing.
Do you have an idea ?
Found it.
I compile libarchive with Mingw64 so I have to compile my Qt application with the 64bit version of Mingw.
I'm attempting to build an application with QTCreator on Windows10 that uses the QVTKWidget, but I get linker error(s):
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QVTKWidget::QVTKWidget(class QWidget *,class QFlags<enum Qt::WindowType>)" referenced in function "public: void __cdecl Ui_MainWindow::setupUi(class QMainWindow *)"
I've downloaded Qt5.5 for msvc2013 and msvc2013_64. I've downloaded VTK7, and built it with Qt support using CMake. I built a vtk32 and vtk64. I've copied D:\VTK\vtk32\bin\Release\QVTKWidgetPlugin.dll to C:\Qt\Tools\QtCreator\bin\plugins\designer and when I start QTCreator, the QVTKWidget shows up on the bottom under the QVTK section of the available form controls.
I add the QVTKWidget to my form and build the application using msvc2013 Release. Then I get the linker errors. What lib am I missing?
Below is my .pro file
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MIViewer
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
win32 {
INCLUDEPATH += D:\VTK\VTK-7.0.0\GUISupport\Qt
INCLUDEPATH += D:\VTK\VTK-7.0.0\Common\Core
INCLUDEPATH += D:\VTK\VTK-7.0.0\Rendering\Core
}
win32-msvc2013 {
INCLUDEPATH += D:\VTK\vtk32\GUISupport\Qt
INCLUDEPATH += D:\VTK\vtk32\Interaction\Style
INCLUDEPATH += D:\VTK\vtk32\Rendering\Core
INCLUDEPATH += D:\VTK\vtk32\Rendering\OpenGL2
INCLUDEPATH += D:\VTK\vtk32\Common\Core
LIBS += -LD:\VTK\vtk32\lib\Release
}
win32-msvc2013_64 {
INCLUDEPATH += D:\VTK\vtk64\GUISupport\Qt
INCLUDEPATH += D:\VTK\vtk64\Interaction\Style
INCLUDEPATH += D:\VTK\vtk64\Rendering\Core
INCLUDEPATH += D:\VTK\vtk64\Rendering\OpenGL2
INCLUDEPATH += D:\VTK\vtk64\Common\Core
LIBS += -LD:\VTK\vtk64\lib\Release
}
LIBS += -lQVTKWidgetPlugin \
-lvtkGUISupportQt-7.0 \
-lvtkRenderingQt-7.0
Just wanted to answer my own question in case anyone else comes across this post with a similar program. I was able fix this by re-compiling the 32-bit VTK with all of the Cmake Qt options selected and paths filled out. I didn't have the correct paths in CMake, but cmake didn't complain and generated the VS solution files. And I didn't notice that 20% of the projects had failed until I tried to re-compile VTK.
When trying to diagnose linker errors, it's nothing mysterious. There's something missing! Just going through the checklist of dependencies one by one solved it for me.
I am using Qt Creator 2.4.1(Based on Qt 4.7.4) ..
Now I want to open the .mat file which I got from Matlab.
I am using the basic function matOpen
Initially, I knew the headers required. They are mat.h, matrix.h and tmw.h.
Now, before running the code, I need to link the libraries. The required libraries as far as I know are libmat.dll and libmw.dll . I added them to the .pro file as follows.
QT += core
QT -= gui
TARGET = mat_open_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
HEADERS += \
mat.h \
matrix.h \
tmwtypes.h
LIBS += -L"C:\Users\skanduri\Documents\C ++\mat_open_test-build-desktop- Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug\libmat.dll"
LIBS += -L"C:\Users\skanduri\Documents\C ++\mat_open_test-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug\libmx.dll"
Still I get error as : undefined reference to matOpen.. m sure the problem is with the linking.. But I dunno how to solve it. and the compiler Qt is using is MinGw .
You are specifying library path only, not the libraries itself. Try
LIBS += -L"C:\Users\skanduri\Documents\C ++\mat_open_test-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug"
LIBS += -llibmx
LIBS += -llibmat
I am writing a tool with Qt Creator which builds but immediately crashes with the message:
"The program can't start because pthreadVC2.dll is missing from your
computer. Try reinstalling the program to fix this problem".
Of course, the "pthreadVC2.dll" library is not missing (and is not corrupted, since it works with other projects), and it is located in the path specified in the Qt pro file:
# DeltaPlots.pro
TARGET = DeltaPlots
QT += core gui
CONFIG += console
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
win32 {
INCLUDEPATH += S:\\3rdparty\\DFS.Infrastructure.ThreadingW \
S:\\3rdparty\\DFS.Infrastructure.File \
"C:\\path\\to\\boost\\boost_1_51_0"
win32-g++:LIBS += -L"S:\\lib\\" -lMyLib
win32-g++:LIBS += -L"S:\\3rdparty\\DFS.Infrastructure.File\\" -lDFS.Infrastructure.FileSystem
win32-g++:LIBS += -L"S:\\3rdparty\\DFS.Infrastructure.ThreadingW\\" -lDFS.Infrastructure.Threading -lpthreadVC2
}
SOURCES += MainWindow.cpp \
entrypoint.cpp
HEADERS += MainWindow.h
FORMS += MainWindow.ui
OTHER_FILES += ProjectList.txt \
ImageList.txt
Platform:
Windows 7
MinGW
Qt 4.8.3
Qt Creator 2.6.0
[Edit: This answer refers to the original question]
Usually you would add
LIBS += -LS:/3rdparty/DFS.Infrastructure.ThreadingW \
-lpthreadVC2
This adds your library's folder as a library search path (Note the capital -L) and pthreadVC2.lib as a library to link against (lower case -l).
You do not need to add the .dll to the LIBS path, as the .dll is loaded at runtime.
But: This approach only works when the .lib is in the same folder as the .dll. I'm a bit surprised you have yours in different locations.
Maybe adding
LIBS += -LS:/3rdparty
would work, but I'm not sure about that.
In any event, you need to deploy the .dll with your .exe for releases.
I'm developing a Qt application in windows. I have created a lib file in visual studio. I have included the header file containing function prototypes in my Qt App and also added lib file in .pro file as follows
win32: LIBS += -L$$PWD/../Lib/ -lCpLib
INCLUDEPATH += $$PWD/../Lib
DEPENDPATH += $$PWD/../Lib
win32: PRE_TARGETDEPS += $$PWD/../Lib/CpLib.lib
I called the functions from my Qt app. It shows compile error as "undefined reference"
Please help me.
Regards....
The specification of your LIBS is passing linker arguments in gcc format (i.e. using -L to specify the directory and -l to specify the library name).
As you have created your lib file in Visual Studio, you'll need to specify the full library name
e.g.
win32: LIBS += yourlibrary.lib
alternatively, recompile the libraries using MinGW