QT5 QWebView linker errors - qt-creator

Right now I'm just trying to get 'www.google.com' to load in a webview when a button is pressed. After I added the webview in the designer the linker starts going crazy. I'm using QT Creater 2.6.1 with QT5 on Windows 7. I added the QT += 'webkit stuff' to the .pro file. I've tried cleaning and rebuilding, still get linker errors.
for some odd reason adding "#include <QWebView>" in any file produces a file not found error: "C:\Users\Scott\Desktop\eCookBook\eCookBook2\cookbook.cpp:3: error: C1083: Cannot open include file: 'QWebView': No such file or directory"
cookbook.h:
#ifndef COOKBOOK_H
#define COOKBOOK_H
#include <QMainWindow>
#include <QtWebKit/QWebElement>
#include <QtWebKit/QtWebKit>
#include <QtWebKitWidgets/QWebPage>
namespace Ui {
class cookBook;
}
class cookBook : public QMainWindow
{
Q_OBJECT
public:
explicit cookBook(QWidget *parent = 0);
~cookBook();
private slots:
void on_pushButton_clicked();
void on_textBrowser_anchorClicked(const QUrl &arg1);
private:
Ui::cookBook *ui;
//QWebPage page;
};
#endif // COOKBOOK_H
cookbook.cpp
#include "cookbook.h"
#include "ui_cookbook.h"
//#include <QWebView>
//#include <QtWebKit/QtWebKit>
cookBook::cookBook(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::cookBook)
{
ui->setupUi(this);
}
cookBook::~cookBook()
{
delete ui;
}
void cookBook::on_pushButton_clicked()
{
ui->listWidgetTest->insertItem(ui->listWidgetTest->count(), "TEST");
const QUrl testsite = "www.google.com";
ui->widget->load(testsite);
ui->widget->show();
}
.pro file
#-------------------------------------------------
#
# Project created by QtCreator 2013-01-23T14:46:45
#
#-------------------------------------------------
QT += core gui
QT += webkit
QT += webkit webkitwidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = eCookBook2
TEMPLATE = app
SOURCES += main.cpp\
cookbook.cpp
HEADERS += cookbook.h
FORMS += cookbook.ui
compiler output:
15:04:58: Running steps for project eCookBook2...
15:04:58: Configuration unchanged, skipping qmake step.
15:04:58: Starting: "C:\QtCommercial\QtCommercial5.0.0\Tools\QtCreator\bin\jom.exe"
C:\QtCommercial\QtCommercial5.0.0\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include" -I"..\..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtWidgets" -I"..\..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtGui" -I"..\..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtCore" -I"debug" -I"." -I"." -I"..\..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Fodebug\ #C:\Users\Scott\AppData\Local\Temp\cookbook.obj.5244.0.jom
cookbook.cpp
..\eCookBook2\cookbook.cpp(34) : warning C4100: 'arg1' : unreferenced formal parameter
echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "debug\\eCookBook2.exe.embed.manifest">debug\eCookBook2.exe_manifest.rc
if not exist debug\eCookBook2.exe del debug\eCookBook2.exe.embed.manifest>NUL 2>&1
if exist debug\eCookBook2.exe.embed.manifest copy /Y debug\eCookBook2.exe.embed.manifest debug\eCookBook2.exe_manifest.bak
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\eCookBook2.exe.embed.manifest /OUT:debug\eCookBook2.exe #C:\Users\Scott\AppData\Local\Temp\eCookBook2.exe.5244.2012.jom
cookbook.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWebView::QWebView(class QWidget *)" (__imp_??0QWebView##QAE#PAVQWidget###Z) referenced in function "public: void __thiscall Ui_cookBook::setupUi(class QMainWindow *)" (?setupUi#Ui_cookBook##QAEXPAVQMainWindow###Z)
cookbook.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QWebView::metaObject(void)const " (?metaObject#QWebView##UBEPBUQMetaObject##XZ)
cookbook.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QWebView::qt_metacast(char const *)" (?qt_metacast#QWebView##UAEPAXPBD#Z)
cookbook.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QWebView::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QWebView##UAEHW4Call#QMetaObject##HPAPAX#Z)
cookbook.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QWebView::event(class QEvent *)" (?event#QWebView##UAE_NPAVQEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __thiscall QWebView::sizeHint(void)const " (?sizeHint#QWebView##UBE?AVQSize##XZ)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mousePressEvent(class QMouseEvent *)" (?mousePressEvent#QWebView##MAEXPAVQMouseEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent#QWebView##MAEXPAVQMouseEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent#QWebView##MAEXPAVQMouseEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent#QWebView##MAEXPAVQMouseEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::wheelEvent(class QWheelEvent *)" (?wheelEvent#QWebView##MAEXPAVQWheelEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::keyPressEvent(class QKeyEvent *)" (?keyPressEvent#QWebView##MAEXPAVQKeyEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent#QWebView##MAEXPAVQKeyEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::focusInEvent(class QFocusEvent *)" (?focusInEvent#QWebView##MAEXPAVQFocusEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::focusOutEvent(class QFocusEvent *)" (?focusOutEvent#QWebView##MAEXPAVQFocusEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::paintEvent(class QPaintEvent *)" (?paintEvent#QWebView##MAEXPAVQPaintEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::resizeEvent(class QResizeEvent *)" (?resizeEvent#QWebView##MAEXPAVQResizeEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent#QWebView##MAEXPAVQContextMenuEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent#QWebView##MAEXPAVQDragEnterEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent#QWebView##MAEXPAVQDragMoveEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent#QWebView##MAEXPAVQDragLeaveEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dropEvent(class QDropEvent *)" (?dropEvent#QWebView##MAEXPAVQDropEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::changeEvent(class QEvent *)" (?changeEvent#QWebView##MAEXPAVQEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::inputMethodEvent(class QInputMethodEvent *)" (?inputMethodEvent#QWebView##MAEXPAVQInputMethodEvent###Z)
cookbook.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QWebView::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery#QWebView##UBE?AVQVariant##W4InputMethodQuery#Qt###Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QWebView::focusNextPrevChild(bool)" (?focusNextPrevChild#QWebView##MAE_N_N#Z)
cookbook.obj : error LNK2001: unresolved external symbol "protected: virtual class QWebView * __thiscall QWebView::createWindow(enum QWebPage::WebWindowType)" (?createWindow#QWebView##MAEPAV1#W4WebWindowType#QWebPage###Z)
cookbook.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWebView::~QWebView(void)" (__imp_??1QWebView##UAE#XZ) referenced in function "public: virtual void * __thiscall QWebView::`scalar deleting destructor'(unsigned int)" (??_GQWebView##UAEPAXI#Z)
cookbook.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebView::load(class QUrl const &)" (__imp_?load#QWebView##QAEXABVQUrl###Z) referenced in function "private: void __thiscall cookBook::on_pushButton_clicked(void)" (?on_pushButton_clicked#cookBook##AAEXXZ)
debug\eCookBook2.exe : fatal error LNK1120: 29 unresolved externals
jom: C:\Users\Scott\Desktop\eCookBook\eCookBook2-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\Makefile.Debug [debug\eCookBook2.exe] Error 1120
jom: C:\Users\Scott\Desktop\eCookBook\eCookBook2-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\Makefile [debug] Error 2
15:05:01: The process "C:\QtCommercial\QtCommercial5.0.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project eCookBook2 (kit: Desktop Qt 5.0.0 MSVC2010 32bit (SDK))
When executing step 'Make'

First try "Run qmake" (from the "Build" menu in Creator) to regenerate the make files and then re-build. Basically you need "Run qmake" after every modification in the .pro file.

Press Ctrl+5 in Creator.
Uncheck "Shadow build".
Change your .pro file line to:
QT += core gui network webkit webkitwidgets
Rebuild the project

The same bug fixed. Try to add path to qwebview.h in the include like:
(change "QtWebKitWidgets" to yours)
#include <QtWebKitWidgets/QWebView.h>
instead of just #include <QWebView.h>
Try to add it to all files that use QWebView.

Related

unresolved external symbol with qt 5.5.1 and visual studio 2010

Greeting
I have application made with QT 4.8.5 and Visual Studio 2008. For some reason i need to update my QT to 5.5.1 and my Visual Studio to 2010. I downloaded qt-everywhere-opensource-src-5.5.1 and build-ed for Visual Studio 2010.
configure -debug-and-release -opensource -platform win32-msvc2010 -icu -openssl -nomake examples -prefix C:\QT-Compile
nmake
nmake install
When i build my solution, I get following errors :
Error 1 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_ttu_manager.obj
Error 2 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_vdm_manager.obj
Error 3 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_wosa_event_listener.obj
Error 4 error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) referenced in function "public: virtual struct QMetaObject const * __thiscall RPTRManager::metaObject(void)const " (?metaObject#RPTRManager##UBEPBUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_rptr_manager.obj
Error 5 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_jptr_manager.obj
Error 6 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_sptr_manager.obj
Error 7 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_siu_manager.obj
Error 8 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_cim_manager.obj
Error 9 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_dep_manager.obj
Error 10 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_idc_manager.obj
Error 11 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_pin_manager.obj
Error 12 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_device_manager.obj
Error 13 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_bcr_manager.obj
Error 14 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_cam_manager.obj
Error 15 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_cdm_manager.obj
Error 16 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_controller.obj
Error 17 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_user_interface.obj
Error 18 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_ssl_connection_manager.obj
Error 19 error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject#QObjectData##QBEPAUQMetaObject##XZ) C:\Hashemi\Build\New_ATM\moc_fit_manager.obj
Error 20 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_vdm_manager.obj
Error 21 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_wosa_event_listener.obj
Error 22 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_jptr_manager.obj
Error 23 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_sptr_manager.obj
Error 24 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_siu_manager.obj
Error 25 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_ttu_manager.obj
Error 26 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_dep_manager.obj
Error 27 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) referenced in function __ehhandler$?startListenSignal#IDCManager##QAEXVQString###Z C:\Hashemi\Build\New_ATM\moc_idc_manager.obj
Error 28 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_pin_manager.obj
Error 29 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_rptr_manager.obj
Error 30 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_bcr_manager.obj
Error 31 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_cam_manager.obj
Error 32 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_cdm_manager.obj
Error 33 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_cim_manager.obj
Error 34 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_controller.obj
Error 35 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_user_interface.obj
Error 36 error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast#QObject##UAEPAXPBD#Z) C:\Hashemi\Build\New_ATM\moc_fit_manager.obj
Actually there is a lot more, I'm just mentioning some of them.
I know unresolved external symbol error is about linker can not finding libraries but as i checked in Linker->General->Additional Library Directories, All lib directory are imported.
What i'm missing here !!!
Thanks in advance!!!
I found the problem.
Before QT5 i was using following lines in my CMakeLists.txt.
FIND_PACKAGE(Qt5 REQUIRED)
...
TARGET_LINK_LIBRARIES(project-name
${QT_LIBRARIES}
...)
With QT5 i need to change them to following form.
find_package(Qt5 REQUIRED COMPONENTS Core Gui Network Sql WebKit Widgets Multimedia)
...
TARGET_LINK_LIBRARIES(project-name
Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Sql Qt5::WebKit Qt5::Multimedia
...)

Qt: linking errors

I'm new to Qt and I'm receiving the following errors while linking my project:
qtmain.lib(qtmain_win.obj) : error LNK2038: mismatch detected for '_MSC_VER': va
lue '1600' doesn't match value '1700' in main.obj
main.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::
_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
main.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::
_Syserror_map(int)" (?_Syserror_map#std##YAPBDH#Z)
main.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_al
loc(void)" (?_Xbad_alloc#std##YAXXZ)
main.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of
_range(char const *)" (?_Xout_of_range#std##YAXPBD#Z)
main.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xlength
_error(char const *)" (?_Xlength_error#std##YAXPBD#Z)
main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) publ
ic: static void __fastcall QListData::dispose(struct QListData::Data *)" (__imp_
?dispose#QListData##SIXPAUData#1##Z)
main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) publ
ic: static int __fastcall QApplication::exec(void)" (__imp_?exec#QApplication##S
IHXZ)
moc_mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllim
port) void __fastcall qt_assert(char const *,char const *,int)" (__imp_?qt_asser
t##YIXPBD0H#Z)
mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport
) public: static class QString __fastcall QCoreApplication::translate(char const
*,char const *,char const *,int)" (__imp_?translate#QCoreApplication##SI?AVQStr
ing##PBD00H#Z)
mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport
) public: static void __fastcall QMetaObject::connectSlotsByName(class QObject *
)" (__imp_?connectSlotsByName#QMetaObject##SIXPAVQObject###Z)
d:\c\output\main\main32.exe : fatal error LNK1120: 10 unresolved externals
This is my linking command:
"%VCInstallDir%\bin\link.exe" /MACHINE:X86 /LIBPATH:"%VCInstallDir%\lib" /LIBPATH:"%VCInstallDir%\atlmfc\lib" /LIBPATH:"%WindowsSdkDir%\Lib\win8\um\%_pf%" LIBPATH:"e:\Qt\Qt5.0.2\5.0.2\msvc2010\lib" /MERGE:code=.text /errorReport:none /DEBUG /FIXED /INCREMENTAL:NO /NXCOMPAT /LTCG /MAP:"d:\c\temp\main\win32\main.map" MAPINFO:EXPORTS /NODEFAULTLIB /NOLOGO /OPT:REF /OPT:ICF /LARGEADDRESSAWARE:NO /DYNAMICBASE:NO /OUT:"d:\c\output\main\main32.exe" /MANIFESTUAC:NO /SAFESEH:NO /SUBSYSTEM:WINDOWS /VERSION:1.0 /WX /MERGE:.rdata=.text /FIXED:NO libcmt.lib kernel32.lib user32.lib advapi32.lib shlwapi.lib shell32.lib secur32.lib psapi.lib ole32.lib gdi32.lib comctl32.lib ws2_32.lib crypt32.lib wininet.lib msxml2.liboleaut32.lib netapi32.lib userenv.lib comdlg32.lib mpr.lib uuid.lib Qt5Core.libQt5Gui.lib Qt5Widgets.lib qtmain.lib libEGL.lib libGLESv2.lib "d:\c\temp\main\win32\main.obj" "d:\c\temp\main\win32\moc_mainwindow.obj" "d:\c\temp\main\win32\ui_mainwindow.obj" "d:\c\temp\main\win32\mainwindow.obj"
Are there some missing libraries or other dependencies? Thank you.
You can't use Qt library built with another version of VS. Compile Qt using your compiler.

superbible lnk2019 glew

I'm working with Superbible 5th edition and I've already come across a problem with the first program. I've been able to fix a good amount of problems by adding in Windows.h and taking out the line #define FREEGLUT_STATIC, but I can't get past the linker errors I have right now.
#include <Windows.h>
#include <GLTools.h>
#include <GLShaderManager.h>
#include <gl\glew.h>
#include <gl\glut.h>
GLBatch triangleBatch;
GLShaderManager shaderManager;
void ChangeSize(int w, int h)
{
glViewport(0, 0, w, h);
}
void SetupRC()
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
shaderManager.InitializeStockShaders();
GLfloat vVerts[] =
{
-0.5f, 0.0f, 0.0f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f
};
triangleBatch.Begin(GL_TRIANGLES, 3);
triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}
void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f };
shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
triangleBatch.Draw();
glutSwapBuffers();
}
int main(int argc, char* argv[])
{
gltSetWorkingDirectory(argv[0]);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(800, 600);
glutCreateWindow("Triangle");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);
GLenum err = glewInit();
if(GLEW_OK != err)
{
fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
return 1;
}
SetupRC();
glutMainLoop();
return 0;
}
and these are the errors I am getting:
1>triangle test.obj : error LNK2019: unresolved external symbol "public: void __thiscall GLBatch::End(void)" (?End#GLBatch##QAEXXZ) referenced in function "void __cdecl SetupRC(void)" (?SetupRC##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: void __thiscall GLBatch::Begin(unsigned int,unsigned int,unsigned int)" (?Begin#GLBatch##QAEXIII#Z) referenced in function "void __cdecl SetupRC(void)" (?SetupRC##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: bool __thiscall GLShaderManager::InitializeStockShaders(void)" (?InitializeStockShaders#GLShaderManager##QAE_NXZ) referenced in function "void __cdecl SetupRC(void)" (?SetupRC##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: void __thiscall GLBatch::CopyVertexData3f(float (*)[3])" (?CopyVertexData3f#GLBatch##QAEXPAY02M#Z) referenced in function "public: void __thiscall GLBatch::CopyVertexData3f(float *)" (?CopyVertexData3f#GLBatch##QAEXPAM#Z)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall GLBatch::Draw(void)" (?Draw#GLBatch##UAEXXZ) referenced in function "void __cdecl RenderScene(void)" (?RenderScene##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: int __cdecl GLShaderManager::UseStockShader(enum GLT_STOCK_SHADER,...)" (?UseStockShader#GLShaderManager##QAAHW4GLT_STOCK_SHADER##ZZ) referenced in function "void __cdecl RenderScene(void)" (?RenderScene##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol _glewGetErrorString referenced in function _main
1>triangle test.obj : error LNK2019: unresolved external symbol _glewInit referenced in function _main
1>triangle test.obj : error LNK2019: unresolved external symbol "void __cdecl gltSetWorkingDirectory(char const *)" (?gltSetWorkingDirectory##YAXPBD#Z) referenced in function _main
1>triangle test.obj : error LNK2019: unresolved external symbol "public: __thiscall GLBatch::GLBatch(void)" (??0GLBatch##QAE#XZ) referenced in function "void __cdecl `dynamic initializer for 'triangleBatch''(void)" (??__EtriangleBatch##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: __thiscall GLShaderManager::GLShaderManager(void)" (??0GLShaderManager##QAE#XZ) referenced in function "void __cdecl `dynamic initializer for 'shaderManager''(void)" (??__EshaderManager##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall GLBatch::~GLBatch(void)" (??1GLBatch##UAE#XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'triangleBatch''(void)" (??__FtriangleBatch##YAXXZ)
1>triangle test.obj : error LNK2019: unresolved external symbol "public: __thiscall GLShaderManager::~GLShaderManager(void)" (??1GLShaderManager##QAE#XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'shaderManager''(void)" (??__FshaderManager##YAXXZ)
It should be able to compile with just the included files from the website, but it's not.
You'll have to add some libraries to the project that provide the mentioned function bodies. You can do this using the project properties ("Linker", "Input", "Additional Dependencies") or a #pragma line anywhere in your source code:
#pragma comment(lib, "libraryname.lib")
I don't know about the library name; it's most likely explained somewhere in the book, but it might be GLTools.lib or GLShaderManager.lib (or something different; you should have these files somewhere alongside the include files (but in a lib directory).
Edit: You're missing the lib file for glew as well (glew32.lib).

Compiling IBPP with VS2010 - linking issue

I have a C++ project that uses IBPP to access a firebird database. I simply do it by including the file "all_in_one.cpp" in my project, and all went well with both VS6 (yes, I still have some of those) and VS2008.
Now I am considering using VS2010. It is compiling ok but does not link. I know VS2010 comes with a new implementation of the STL, and the linking problem obviously is around the STL.
I have tried creating a new project with VS2010, just adding the all_in_one.cpp file. It is a simple project that does not contain anything else, and it still fails to link with the same missing symbols. I can't figure out what's missing, incorrect. I have tried linking to the same libraries as in VS2008 (including the path). Nothing is working so far.
Here are the errors:
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct std::_Smanip<__int64> __cdecl std::setw(__int64)" (__imp_?setw#std##YA?AU?$_Smanip#_J#1#_J#Z) referenced in function "public: char const * __thiscall IBPP::DBKey::AsString(void)const " (?AsString#DBKey#IBPP##QBEPBDXZ)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base12::_Orphan_all(void)" (__imp_?_Orphan_all#_Container_base12#std##QAEXXZ) referenced in function "public: class std::vector<double,class std::allocator<double> > & __thiscall std::vector<double,class std::allocator<double> >::operator=(class std::vector<double,class std::allocator<double> > const &)" (??4?$vector#NV?$allocator#N#std###std##QAEAAV01#ABV01##Z)
all_in_one.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock#?$basic_streambuf#DU?$char_traits#D#std###std##UAEXXZ)
all_in_one.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock#?$basic_streambuf#DU?$char_traits#D#std###std##UAEXXZ)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::showmanyc(void)" (?showmanyc#?$basic_streambuf#DU?$char_traits#D#std###std##MAE_JXZ)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::xsgetn(char *,__int64)" (?xsgetn#?$basic_streambuf#DU?$char_traits#D#std###std##MAE_JPAD_J#Z)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::xsputn(char const *,__int64)" (?xsputn#?$basic_streambuf#DU?$char_traits#D#std###std##MAE_JPBD_J#Z)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setbuf(char *,__int64)" (?setbuf#?$basic_streambuf#DU?$char_traits#D#std###std##MAEPAV12#PAD_J#Z)
all_in_one.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) __int64 const std::_BADOFF" (__imp_?_BADOFF#std##3_JB)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error#std##YAXPBD#Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xlen(void)const " (?_Xlen#?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##QBEXXZ)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xout_of_range(char const *)" (__imp_?_Xout_of_range#std##YAXPBD#Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xran(void)const " (?_Xran#?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##QBEXXZ)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base12::~_Container_base12(void)" (__imp_??1_Container_base12#std##QAE#XZ) referenced in function __unwindfunclet$??0?$_String_val#DV?$allocator#D#std###std##QAE#V?$allocator#D#1##Z$0
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base12::_Container_base12(void)" (__imp_??0_Container_base12#std##QAE#XZ) referenced in function "public: __thiscall std::_String_val<char,class std::allocator<char> >::_String_val<char,class std::allocator<char> >(class std::allocator<char>)" (??0?$_String_val#DV?$allocator#D#std###std##QAE#V?$allocator#D#1##Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct std::_Iterator_base12 * * __thiscall std::_Container_base12::_Getpfirst(void)const " (__imp_?_Getpfirst#_Container_base12#std##QBEPAPAU_Iterator_base12#2#XZ) referenced in function "protected: void __thiscall std::vector<class ibpp_internals::TransactionImpl *,class std::allocator<class ibpp_internals::TransactionImpl *> >::_Orphan_range(class ibpp_internals::TransactionImpl * *,class ibpp_internals::TransactionImpl * *)const " (?_Orphan_range#?$vector#PAVTransactionImpl#ibpp_internals##V?$allocator#PAVTransactionImpl#ibpp_internals###std###std##IBEXPAPAVTransactionImpl#ibpp_internals##0#Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall std::ios_base::width(__int64)" (__imp_?width#ios_base#std##QAE_J_J#Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits#D#std###std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (__imp_?sputn#?$basic_streambuf#DU?$char_traits#D#std###std##QAE_JPBD_J#Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits#D#std###std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall std::ios_base::width(void)const " (__imp_?width#ios_base#std##QBE_JXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits#D#std###std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
It seems your library/DLL is exporting some templated/STL stuff.
STL is not binary compatible among different compiler versions.
You need to use same compiler/linker/bitness to compile and link the DLL/EXE if STL/template is involved.
Remove the all_in_one.cpp from build and use the other files from core to build the library.
Concerning linker errors 10 and 11 from the error list above, I have the following solution
(probably it fixes all errors).
Open the property pages of your project by right clicking your project inside the Solution Explorer and selecting "Properties".
Inside the "Property Pages"-window:
--> open "Configuration Properties" from left menu
--> select "VC++ Directories" on the left
--> go to "Library Directories" on the right
--> the corresponding string should contain a sub-string like
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib"
--> replace "9.0" by "10.0"
to make the changes working "re"build your solution (perhaps clean your solution first).

wxWidgets defaultlib 'MSVCRT' conflicts problem

So, I have a small project with a very simple code. All it really does is create a wxFrame the following way:
wxFrame(NULL, -1, title, wxPoint(-1, -1), wxSize(380, 220))
There is no compiling problem to any of my code whatsoever. The problem occures when I do this line:
IMPLEMENT_APP(App);
App is:
class App: public wxApp
So, when I do that and I hit compile, I have the following errors:
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>CApp.obj : warning LNK4248: unresolved typeref token (01000019) for 'wxVideoMode'; image may not run
1>CLoadingFrame.obj : warning LNK4248: unresolved typeref token (01000019) for 'wxToolTip'; image may not run
1>CLoadingFrame.obj : warning LNK4248: unresolved typeref token (0100001A) for 'wxDropTarget'; image may not run
1>CLoadingFrame.obj : error LNK2020: unresolved token (0A000DB2) "int g_isPainting" (?g_isPainting##3HA)
1>CApp.obj : error LNK2020: unresolved token (0A000DBE) "int g_isPainting" (?g_isPainting##3HA)
1>CLoadingFrame.obj : error LNK2028: unresolved token (0A000DB4) "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert##$$FYAXPBDH000#Z) referenced in function "protected: void __thiscall wxShadowObjectFields_wxImplementation_HashTable::ResizeTable(unsigned int)" (?ResizeTable#wxShadowObjectFields_wxImplementation_HashTable##$$FIAEXI#Z)
1>CApp.obj : error LNK2028: unresolved token (0A000DC0) "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert##$$FYAXPBDH000#Z) referenced in function "protected: void const * __thiscall wxVectorBase::GetItem(unsigned int)const " (?GetItem#wxVectorBase##$$FIBEPBXI#Z)
1>CApp.obj : error LNK2019: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert##$$FYAXPBDH000#Z) referenced in function "protected: void const * __thiscall wxVectorBase::GetItem(unsigned int)const " (?GetItem#wxVectorBase##$$FIBEPBXI#Z)
1>CLoadingFrame.obj : error LNK2001: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert##$$FYAXPBDH000#Z)
1>CApp.obj : error LNK2001: unresolved external symbol "int g_isPainting" (?g_isPainting##3HA)
1>CLoadingFrame.obj : error LNK2001: unresolved external symbol "int g_isPainting" (?g_isPainting##3HA)
1>CApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,char const *)" (?OnAssertFailure#wxAppConsole##UAEXPBDH000#Z)
1>CApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssert(char const *,int,char const *,char const *)" (?OnAssert#wxAppConsole##UAEXPBDH00#Z)
1>D:\WickedLauncher\WickedLauncherv2\Debug\WickedLauncherv2.exe : fatal error LNK1120: 8 unresolved externals
I would appreciate any help!
Regards.
where is defined g_isPainting ?
Did you add the right library to the linker for wxAppConsole ?

Resources