I'm foraying into C++ and QT 5.9.
I'm running QT Tools for VS 2017 with QT 5.9 libraries added to VS 2017 and am building QT GUI applications without issue.
However, when I try to build a very simple example that invloves QWebEngineView or QWebEnginePage, I'm geting unresolved external symbol "__declspec(dllimport)...on QWebEngineView...
I've also noticed that a few of the #includes don't match the examples on the QT 5.9 doc site...
I've uninstalled and re-installed QT 5.9 and also 5.6 a few times and included every module I could into each, just in case!
Code
#include <QtWidgets/QtWidgets>
#include <QtWidgets/QApplication>
#include <QtWebEngineWidgets/QtWebEngineWidgets>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebEngineView view;
view.show();
view.load(QUrl("http://google.com"));
return a.exec();
}
Build Output
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QWebEngineView::QWebEngineView(class QWidget *)" (__imp_??0QWebEngineView##QEAA#PEAVQWidget###Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QWebEngineView::~QWebEngineView(void)" (__imp_??1QWebEngineView##UEAA#XZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QWebEngineView::load(class QUrl const &)" (__imp_?load#QWebEngineView##QEAAXAEBVQUrl###Z) referenced in function main
You need to add the QtWebEngine library to the linker. Open the qmake .pro file and add QT += webenginewidgets. http://doc.qt.io/qt-5/qwebengineview.html
Related
I have made a custom widget + plugin and implemented it into my Qt Designer. From there I then linked the *.lib file into my test application. Error:
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall GLineEdit::GLineEdit(class QWidget *)" (??0GLineEdit##QAE#PAVQWidget###Z) referenced in function "public: void __thiscall Ui_MainWindow::setupUi(class QMainWindow *)" (?setupUi#Ui_MainWindow##QAEXPAVQMainWindow###Z)
which doesnt make much sense as I have the correct includes in my the setupUi() function. Here is the relevant source code of the projects:
Widget Project
Plugin Project
Temporary Project
I have designed an Image using Rectangle in QML in the Qt platform. I would like to take this QML file and add it on to my other Project in Visual Studio with Qt.
I have added my QML file in the resources of my Qt project in Visual Studio and have used the following code but gives me several external unresolved errors.
QQuickView *view = new QQuickView();
view->setSource(QUrl("main.qml"));
I would be glad if someone could help me out in using this QML Image as an Icon to the toolBox.
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport)
public: __cdecl QQuickView::QQuickView(class QWindow *)"
(__imp_??0QQuickView##QEAA#PEAVQWindow###Z) referenced in function
"public: __cdecl QtGuiApplication1::QtGuiApplication1(class QWidget
*)" (??0QtGuiApplication1##QEAA#PEAVQWidget###Z) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio
n1\QtGuiApplication1.obj 1 Error LNK2019 unresolved external symbol
"__declspec(dllimport) public: virtual __cdecl
QQuickView::~QQuickView(void)" (__imp_??1QQuickView##UEAA#XZ)
referenced in function "public: virtual void * __cdecl
QQuickView::`scalar deleting destructor'(unsigned int)"
(??_GQQuickView##UEAAPEAXI#Z) QtGuiApplication1
C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio
n1\QtGuiApplication1.obj 1 Error LNK2019 unresolved external symbol
"__declspec(dllimport) public: void __cdecl
QQuickView::setSource(class QUrl const &)"
(__imp_?setSource#QQuickView##QEAAXAEBVQUrl###Z) referenced in
function "public: __cdecl QtGuiApplication1::QtGuiApplication1(class
QWidget *)"
(??0QtGuiApplication1##QEAA#PEAVQWidget###Z) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio
n1\QtGuiApplication1.obj 1 Error LNK2001 unresolved external symbol
"public: virtual class QAccessibleInterface * __cdecl
QQuickWindow::accessibleRoot(void)const "
(?accessibleRoot#QQuickWindow##UEBAPEAVQAccessible
Interface##XZ) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio
n1\QtGuiApplication1.obj 1
I am using Visual Studio with Qt and I think I need not add anything to .pro file.
I am trying to compile this simple qt application with Visual Studio express 2013 for Desktop:
#include <QApplication.h>
#include <QTextEdit.h>
int main(int argv, char **args)
{
QApplication app(argv, args);
QTextEdit textEdit;
textEdit.show();
return app.exec();
}
but when I compile I have this error :
Errore 1 error LNK2019: riferimento al simbolo esterno
"__declspec(dllimport) public: __thiscall
QApplication::QApplication(int &,char * *,int)"
(__imp_??0QApplication##QAE#AAHPAPADH#Z) non risolto nella funzione
_main C:\Users\Enrico\Documents\Visual Studio 2013\Projects\Progetto2\Progetto2\Origine.obj Progetto2
English:
Error 1 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall
QApplication::QApplication(int &,char * *,int)"
(__imp_??0QApplication##QAE#AAHPAPADH#Z) referenced in function
_main C:\Users\Enrico\Documents\Visual Studio 2013\Projects\Progetto2\Progetto2\Origine.obj Progetto2
Thanks for everyone who helps me.
The root cause is the Qt libraries like QtCore5.dll are not being linked. You can manually specify them by editing the Linker options to your project, but but the elegant way is to use the Qt Visual Studio Add-in to easily do a number of things such as create new Qt projects with the Qt libraries selected. This will resolve your link error. The add-in also adds debugger visualization for Qt types, ties in Qt Designer, and many other useful things for using Qt for within Visual Studio.
But add-ins are not supported in Visual Studio Express. Instead you must install Visual Studio 2013 Community. VS 2015 Community is now shipping also, but the Qt add-in hasn't been updated to work with it yet.
I am new to c++ and visual studio 2012 so probably the problem is between the screen and the chair. I performed the following steps;
I made a simple proto file with the option optimize_for = LITE_RUNTIME
Create the matching h and c files with protoc
Compiled the library libprotobuf-lite.lib
Created a new console Visual Studio 2012 project.
Copied the libprotobuf-lite.lib where my single source file is.
Created a new folder named protobuffers
Copied the c, h and the google directory from the protobuffers src directory to the protobuffers folder
Added the protobuffers folder as an Additional Include Directory
Added the library file to the linker through Additional Dependencies
Compiled the following source file;
#include <iostream>
#include "protobuffers\genome.pb.h"
int main()
{
genomeMessage::Genome genome;
return 0;
}
Stuck... I get the following error;
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl genomeMessage::Genome::Genome(void)" (??0Genome#genomeMessage##QEAA#XZ) referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl genomeMessage::Genome::~Genome(void)" (??1Genome#genomeMessage##UEAA#XZ) referenced in function main
1>C:\Projects\testproto\x64\Debug\testproto.exe : fatal error LNK1120: 2 unresolved externals
So I know it is not a missing lib file because if I move the lib file the linker complains that it can't find it. The problem is that I have no clue how to fix this ... anyone?
According to this message:
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl genomeMessage::Genome::Genome(void)" (??0Genome#genomeMessage##QEAA#XZ) referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl genomeMessage::Genome::~Genome(void)" (??1Genome#genomeMessage##UEAA#XZ) referenced in function main
the source file that declares genomeMessage::Genome::Genome(void) and genomeMessage::Genome::~Genome(void) is not part of your project.
In particular, it sounds like you haven't added the genome.pb.cc file (which is created by the Protocol Buffers compiler) to your project.
I have some link error problems when trying to compile using jrtplib and jthread on my simple project. The errors are:
Error 4 fatal error LNK1120: 3 unresolved externals C:\Users\Chicko\Desktop\tryout\Debug\tryout.exe
Error 1 error LNK2019: unresolved external symbol "public: virtual __thiscall RTPSession::~RTPSession(void)" (??1RTPSession##UAE#XZ) referenced in function _wmain tryout.obj
Error 2 error LNK2019: unresolved external symbol "public: __thiscall RTPSessionParams::RTPSessionParams(void)" (??0RTPSessionParams##QAE#XZ) referenced in function _wmain tryout.obj
Error 3 error LNK2019: unresolved external symbol "public: __thiscall RTPSession::RTPSession(class RTPRandom *,class RTPMemoryManager *)" (??0RTPSession##QAE#PAVRTPRandom##PAVRTPMemoryManager###Z) referenced in function _wmain tryout.obj
and here is my main program:
// tryout.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <rtpsession.h> //Confused to put "" or <>
#include <rtpsessionparams.h>
#include <rtpudpv4transmitter.h>
int _tmain(int argc, _TCHAR* argv[])
{
RTPSession session;
RTPSessionParams sessionparams;
RTPUDPv4TransmissionParams transparams;
sessionparams.SetOwnTimestampUnit(1.0/8000.0);
transparams.SetPortbase(8000);
return 0;
}
For your information, I do not import any header file from those libraries into my project. I use additional include libraries in the project setting and put `"..\jlib\jthread-1.2.1\src";"..\jlib\jrtplib3.8.2\src" (this is the folder where all the headers are stored). How do I fix this? Where should i put jrtplib.lib and jthread.lib? Please help...
Have you added jrtplib.lib and jthread.lib under your project linker options?
You can do this on the project property page under
"Configuration properties->Linker->Input->Additional Dependencies" and make sure that the directory that contains the lib files has been added to your library path: Either on the project properties
"Linker->General->Additional Library Directories"
or under the global VS settings (Doesn't apply to VC2010)
"Tools->Options" "Projects and Solutions->VC++ Directories->Library Files"
Under VC2010 you'll have to edit the property sheet of the project.
I see that it's a bit late to answer and I'm not so expert on Windows (I'm more a Linux user), but some day ago I've tried JRTPLIB on Windows and I had the same problem when I compiled the example in release mode and the lib in debug mode (I see that you use the debug mode). Hope it can help.