6 "error LNK2019: unresolved external symbol" [closed] - c++

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I got 6 unresolved externals. I know what it means but I don't know how to fix it.
Collision.cpp
#include "Collision.h"
void Collision::Collide(Entity &entity1, Entity &entity2)
{
if(entity1.getX() + entity1.getWidth() > entity2.getX() ||
entity1.getX() < entity2.getX() + entity2.getWidth() ||
entity1.getY() + entity1.getHeight() > entity2.getY() ||
entity1.getY() < entity2.getY() + entity2.getHeight())
{
entity1.setX(entity1.getX());
entity1.setY(entity1.getY());
}
}
Collision.h
#ifndef COLLISION_H
#define COLLISION_H
#include "Map.h"
#include "Animation.h"
#include "Entity.h"
class Collision
{
public:
void Collide(Entity &entity1, Entity &entity2);
protected:
Map map;
};
#endif
Where collision is called
collision.Collide(player, enemy);
Entity.h
#ifndef Entity_H
#define Entity_H
#include<SFML/Graphics.hpp>
#include"Animation.h"
#include"Camera.h"
class Entity
{
public:
void Initialize();
void LoadContent();
void Update(sf::RenderWindow &Window);
void Draw(sf::RenderWindow &window);
void setX(float newX);
void setY(float newY);
int getHeight();
int getWidth();
float getX();
float getY();
private:
Camera camera;
float x, y;
int currentFrameX, currentFrameY;
sf::Clock clock;
};
#endif // Entity_H
Unresolved externals
1>Collision.obj : error LNK2019: unresolved external symbol "public: void __thiscall Entity::setX(float)" (?setX#Entity##QAEXM#Z) referenced in function "public: void __thiscall Collision::Collide(class Entity &,class Entity &)" (?Collide#Collision##QAEXAAVEntity##0#Z)
1>Collision.obj : error LNK2019: unresolved external symbol "public: void __thiscall Entity::setY(float)" (?setY#Entity##QAEXM#Z) referenced in function "public: void __thiscall Collision::Collide(class Entity &,class Entity &)" (?Collide#Collision##QAEXAAVEntity##0#Z)
1>Collision.obj : error LNK2019: unresolved external symbol "public: int __thiscall Entity::getHeight(void)" (?getHeight#Entity##QAEHXZ) referenced in function "public: void __thiscall Collision::Collide(class Entity &,class Entity &)" (?Collide#Collision##QAEXAAVEntity##0#Z)
1>Collision.obj : error LNK2019: unresolved external symbol "public: int __thiscall Entity::getWidth(void)" (?getWidth#Entity##QAEHXZ) referenced in function "public: void __thiscall Collision::Collide(class Entity &,class Entity &)" (?Collide#Collision##QAEXAAVEntity##0#Z)
1>Collision.obj : error LNK2019: unresolved external symbol "public: float __thiscall Entity::getX(void)" (?getX#Entity##QAEMXZ) referenced in function "public: void __thiscall Collision::Collide(class Entity &,class Entity &)" (?Collide#Collision##QAEXAAVEntity##0#Z)
1>Collision.obj : error LNK2019: unresolved external symbol "public: float __thiscall Entity::getY(void)" (?getY#Entity##QAEMXZ) referenced in function "public: void __thiscall Collision::Collide(class Entity &,class Entity &)" (?Collide#Collision##QAEXAAVEntity##0#Z)
Me thinks it's a problem with not overloading the Entity getX() etc. in the Player/Enemy class properly.

It turns out that Entity.cpp has not been included in my project.
Thanks chris and simonc!

Related

unresolved external linking to static Qwt build

I'm trying to link to a static build of Qwt. to create the static build, I modified qwtconfig.pri to contain
#QWT_CONFIG += QwtDll
and I removed all the #define QWT_DLL references in the code.
However, when I link to the library, I get a bunch of undefined references complaining about QSvgRenderer:
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSvgRenderer::QSvgRenderer(class QObject *)" (__imp_??0QSvgRenderer##QEAA#PEAVQObject###Z) referenced in function "public: void __cdecl QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument#QwtSymbol##QEAAXAEBVQByteArray###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QSvgRenderer::~QSvgRenderer(void)" (__imp_??1QSvgRenderer##UEAA#XZ) referenced in function "public: virtual void * __cdecl QSvgRenderer::`scalar deleting destructor'(unsigned int)" (??_GQSvgRenderer##UEAAPEAXI#Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QSvgRenderer::isValid(void)const " (__imp_?isValid#QSvgRenderer##QEBA_NXZ) referenced in function "void __cdecl qwtDrawSvgSymbols(class QPainter *,class QPointF const *,int,class QSvgRenderer *,class QwtSymbol const &)" (?qwtDrawSvgSymbols##YAXPEAVQPainter##PEBVQPointF##HPEAVQSvgRenderer##AEBVQwtSymbol###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QRectF __cdecl QSvgRenderer::viewBoxF(void)const " (__imp_?viewBoxF#QSvgRenderer##QEBA?AVQRectF##XZ) referenced in function "public: virtual class QRect __cdecl QwtSymbol::boundingRect(void)const " (?boundingRect#QwtSymbol##UEBA?AVQRect##XZ)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QSvgRenderer::load(class QByteArray const &)" (__imp_?load#QSvgRenderer##QEAA_NAEBVQByteArray###Z) referenced in function "public: void __cdecl QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument#QwtSymbol##QEAAXAEBVQByteArray###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSvgRenderer::render(class QPainter *,class QRectF const &)" (__imp_?render#QSvgRenderer##QEAAXPEAVQPainter##AEBVQRectF###Z) referenced in function "public: void __cdecl QwtSymbol::drawSymbol(class QPainter *,class QRectF const &)const " (?drawSymbol#QwtSymbol##QEBAXPEAVQPainter##AEBVQRectF###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl QSvgRenderer::metaObject(void)const " (?metaObject#QSvgRenderer##UEBAPEBUQMetaObject##XZ)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual int __cdecl QSvgRenderer::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QSvgRenderer##UEAAHW4Call#QMetaObject##HPEAPEAX#Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual void * __cdecl QSvgRenderer::qt_metacast(char const *)" (?qt_metacast#QSvgRenderer##UEAAPEAXPEBD#Z)
15>C:\workspace\fixQwt\executables\linkerGUI\bin\Release\linkerGUI.exe : fatal error LNK1120: 9 unresolved externals
Is there something else in the project configuration I need to do so it can link properly to QSvgRenderer?
Guess your version of Qt is without SVG support - or you forget to add it to your project dependency. If you are not interested in SVG stuff at all you could also disable it in qwtconfig.pri as well:
See: "QWT_CONFIG += QwtSvg"

VS2013 with QT5.3.2 using Websocket and got a unresolved external symbol issue

I got a problem with VS2013 and QT5.3.2.
when I am using Websocket, it says unresolved external symbol with QWebSocket::sendTextMessage and other websocket functions.
I have already #include <QtWebSockets/QWebSocket> and set the QT Project Setting and checked WebKit and Network Module.
This is the full error message I have got:
1>mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWebSocket::~QWebSocket(void)" (__imp_??1QWebSocket##UAE#XZ),referenced in function "public: virtual __thiscall MWebSocket::~MWebSocket(void)" (??1MWebSocket##UAE#XZ)
1>MWebSocket.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWebSocket::~QWebSocket(void)" (__imp_??1QWebSocket##UAE#XZ)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWebSocket::QWebSocket(class QString const &,enum QWebSocketProtocol::Version,class QObject *)" (__imp_??0QWebSocket##QAE#ABVQString##W4Version#QWebSocketProtocol##PAVQObject###Z),referenced in function "public: __thiscall MWebSocket::MWebSocket(class QUrl const &,class QObject *)" (??0MWebSocket##QAE#ABVQUrl##PAVQObject###Z)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall QWebSocket::sendTextMessage(class QString const &)" (__imp_?sendTextMessage#QWebSocket##QAE_JABVQString###Z),referenced in function "private: void __thiscall MWebSocket::onConnected(void)" (?onConnected#MWebSocket##AAEXXZ)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebSocket::close(enum QWebSocketProtocol::CloseCode,class QString const &)" (__imp_?close#QWebSocket##QAEXW4CloseCode#QWebSocketProtocol##ABVQString###Z),referenced in function "private: void __thiscall MWebSocket::onTextMessageReceived(class QString)" (?onTextMessageReceived#MWebSocket##AAEXVQString###Z)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebSocket::open(class QUrl const &)" (__imp_?open#QWebSocket##QAEXABVQUrl###Z),referenced in function "public: __thiscall MWebSocket::MWebSocket(class QUrl const &,class QObject *)" (??0MWebSocket##QAE#ABVQUrl##PAVQObject###Z)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebSocket::connected(void)" (__imp_?connected#QWebSocket##QAEXXZ),referenced in function "public: __thiscall MWebSocket::MWebSocket(class QUrl const &,class QObject *)" (??0MWebSocket##QAE#ABVQUrl##PAVQObject###Z)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebSocket::disconnected(void)" (__imp_?disconnected#QWebSocket##QAEXXZ),referenced in function "public: __thiscall MWebSocket::MWebSocket(class QUrl const &,class QObject *)" (??0MWebSocket##QAE#ABVQUrl##PAVQObject###Z)
1>MWebSocket.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebSocket::textMessageReceived(class QString const &)" (__imp_?textMessageReceived#QWebSocket##QAEXABVQString###Z),referenced in function "private: void __thiscall MWebSocket::onConnected(void)" (?onConnected#MWebSocket##AAEXXZ)
1>MWebSocket.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const QWebSocket::staticMetaObject" (__imp_?staticMetaObject#QWebSocket##2UQMetaObject##B)
1>debug/\MapleUI.exe : fatal error LNK1120: 9 unresolved externals
This is the code for Websocket:
//HEADER
#pragma once
#include "global.h"
class MWebSocket : public QObject
{
Q_OBJECT
public:
explicit MWebSocket(const QUrl &url, QObject *parent = Q_NULLPTR);
Q_SIGNALS:
void closed();
private Q_SLOTS:
void onConnected();
void onTextMessageReceived(QString message);
private:
QWebSocket m_webSocket;
QUrl m_url;
};
//CPP
#include "global.h"
#include "MWebSocket.h"
QT_USE_NAMESPACE
//! [constructor]
MWebSocket::MWebSocket(const QUrl &url, QObject *parent) :
QObject(parent),
m_url(url)
{
connect(&m_webSocket, &QWebSocket::connected, this, &MWebSocket::onConnected);
connect(&m_webSocket, &QWebSocket::disconnected, this, &MWebSocket::closed);
m_webSocket.open(QUrl(url));
}
//! [constructor]
//! [onConnected]
void MWebSocket::onConnected()
{
qDebug() << "WebSocket connected";
connect(&m_webSocket, &QWebSocket::textMessageReceived,
this, &MWebSocket::onTextMessageReceived);
m_webSocket.sendTextMessage(QStringLiteral("H2ello, world!"));
}
//! [onConnected]
//! [onTextMessageReceived]
void MWebSocket::onTextMessageReceived(QString message)
{
qDebug() << "Message received:" << message;
m_webSocket.close();
}
//! [onTextMessageReceived]
How can I solve this problem?
Just find out that add Qt5WebSocketsd.lib to the project will fix the problem. I dont know why this need to be manually, cuz before when I using other libs QT5 plugin will add them automate
According to the manual:
Header: #include <QWebSocketServer>
qmake: QT += websockets
Since: Qt 5.3
Inherits: QObject

Open Scene Graph LNK2019 Error

I'm working on a C++ assignment (C++98 & VS2010) using OSG and a pre-built template project to work on. I'm trying to implement mouse picking using the osgUtil/LineSegementIntersector and osgUtil/IntersectionVisitor classes. Unfortunately when I run this code I get a bunch of LNK2001 and LNK2019 errors. The two classes are included at the top of the file, the folder with the osg libraries is included in the linker and the osgUtild.lib file is present in the directory.
The Code:
osgViewer::Viewer *pViewer=dynamic_cast<osgViewer::Viewer*>(aa.asView());
osgUtil::LineSegmentIntersector* picker;
picker = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::PROJECTION, ea.getXnormalized(), ea.getYnormalized());
osgUtil::IntersectionVisitor iv(picker);
pViewer->getCamera()->accept(iv);
if(picker->containsIntersections())
{
osgUtil::LineSegmentIntersector::Intersections intersections = picker->getIntersections();
for(osgUtil::LineSegmentIntersector::Intersections::iterator it = intersections.begin(); it != intersections.end(); it++)
{
for(NodePath::const_reverse_iterator rit = it->nodePath.rbegin(); rit != it->nodePath.rend(); rit++)
{
}
}
}
The Errors:
1>raaOSGSimpleEventHandler.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall osgUtil::IntersectionVisitor::`vbase destructor'(void)" (__imp_??_DIntersectionVisitor#osgUtil##QAEXXZ) referenced in function "public: virtual bool __thiscall raaOSGSimpleEventHandler::handle(class osgGA::GUIEventAdapter const &,class osgGA::GUIActionAdapter &,class osg::Object *,class osg::NodeVisitor *)" (?handle#raaOSGSimpleEventHandler##UAE_NABVGUIEventAdapter#osgGA##AAVGUIActionAdapter#3#PAVObject#osg##PAVNodeVisitor#6##Z)
1>raaOSGSimpleEventHandler.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::multiset<struct osgUtil::LineSegmentIntersector::Intersection,struct std::less<struct osgUtil::LineSegmentIntersector::Intersection>,class std::allocator<struct osgUtil::LineSegmentIntersector::Intersection> > & __thiscall osgUtil::LineSegmentIntersector::getIntersections(void)" (__imp_?getIntersections#LineSegmentIntersector#osgUtil##QAEAAV?$multiset#UIntersection#LineSegmentIntersector#osgUtil##U?$less#UIntersection#LineSegmentIntersector#osgUtil###std##V?$allocator#UIntersection#LineSegmentIntersector#osgUtil###5##std##XZ) referenced in function "public: virtual bool __thiscall raaOSGSimpleEventHandler::handle(class osgGA::GUIEventAdapter const &,class osgGA::GUIActionAdapter &,class osg::Object *,class osg::NodeVisitor *)" (?handle#raaOSGSimpleEventHandler##UAE_NABVGUIEventAdapter#osgGA##AAVGUIActionAdapter#3#PAVObject#osg##PAVNodeVisitor#6##Z)
1>raaOSGSimpleEventHandler.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall osgUtil::IntersectionVisitor::IntersectionVisitor(class osgUtil::Intersector *,struct osgUtil::IntersectionVisitor::ReadCallback *)" (__imp_??0IntersectionVisitor#osgUtil##QAE#PAVIntersector#1#PAUReadCallback#01##Z) referenced in function "public: virtual bool __thiscall raaOSGSimpleEventHandler::handle(class osgGA::GUIEventAdapter const &,class osgGA::GUIActionAdapter &,class osg::Object *,class osg::NodeVisitor *)" (?handle#raaOSGSimpleEventHandler##UAE_NABVGUIEventAdapter#osgGA##AAVGUIActionAdapter#3#PAVObject#osg##PAVNodeVisitor#6##Z)
1>raaOSGSimpleEventHandler.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall osgUtil::LineSegmentIntersector::LineSegmentIntersector(enum osgUtil::Intersector::CoordinateFrame,double,double)" (__imp_??0LineSegmentIntersector#osgUtil##QAE#W4CoordinateFrame#Intersector#1#NN#Z) referenced in function "public: virtual bool __thiscall raaOSGSimpleEventHandler::handle(class osgGA::GUIEventAdapter const &,class osgGA::GUIActionAdapter &,class osg::Object *,class osg::NodeVisitor *)" (?handle#raaOSGSimpleEventHandler##UAE_NABVGUIEventAdapter#osgGA##AAVGUIActionAdapter#3#PAVObject#osg##PAVNodeVisitor#6##Z)
1>raaOSGSimpleEventHandler.obj : error LNK2001: unresolved external symbol "public: virtual class osgUtil::Intersector * __thiscall osgUtil::LineSegmentIntersector::clone(class osgUtil::IntersectionVisitor &)" (?clone#LineSegmentIntersector#osgUtil##UAEPAVIntersector#2#AAVIntersectionVisitor#2##Z)
1>raaOSGSimpleEventHandler.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall osgUtil::LineSegmentIntersector::enter(class osg::Node const &)" (?enter#LineSegmentIntersector#osgUtil##UAE_NABVNode#osg###Z)
1>raaOSGSimpleEventHandler.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall osgUtil::LineSegmentIntersector::leave(void)" (?leave#LineSegmentIntersector#osgUtil##UAEXXZ)
1>raaOSGSimpleEventHandler.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall osgUtil::LineSegmentIntersector::intersect(class osgUtil::IntersectionVisitor &,class osg::Drawable *)" (?intersect#LineSegmentIntersector#osgUtil##UAEXAAVIntersectionVisitor#2#PAVDrawable#osg###Z)
1>raaOSGSimpleEventHandler.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall osgUtil::LineSegmentIntersector::reset(void)" (?reset#LineSegmentIntersector#osgUtil##UAEXXZ)
1>raaOSGSimpleEventHandler.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall osgUtil::LineSegmentIntersector::containsIntersections(void)" (?containsIntersections#LineSegmentIntersector#osgUtil##UAE_NXZ)
1>raaOSGSimpleEventHandler.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall osgUtil::LineSegmentIntersector::~LineSegmentIntersector(void)" (__imp_??1LineSegmentIntersector#osgUtil##UAE#XZ) referenced in function "public: virtual void * __thiscall osgUtil::LineSegmentIntersector::`scalar deleting destructor'(unsigned int)" (??_GLineSegmentIntersector#osgUtil##UAEPAXI#Z)
1>D:\raaOSG(1)\raaOSG\raaOSGResource\Debug\raaOSGSimpleDemoD.exe : fatal error LNK1120: 11 unresolved externals
I can't see anything wrong with my code or my setup, my only thoughts at the moment based on everything I've read is that there's something not being included (a dll somewhere or similar) by the osgUtil library but I can't see how I would be able to resolve that.
Any and all advice would be appreciated - though I definitely require sleep soon so I may not respond immediately.
Dlls are not included at compile time. Specifying the folder only is not sufficient. you need to specify that you are going to use OsgUtild.lib explicitly to linker.

C++/Qt - Open Dialog from MainWindow -Error LNK2019 - LNK2001: unresolved external symbol

basically the goal of the code is to open a dialog that contain a QWebView (with some content) after a botton is clicked
these is what i did:
mainwindow.h:
class MainWindow : public QMainWindow, public Ui::MainWindowUi
{
...
private slots:
void on_ViewDatabase_clicked();
...
}
mainwindow.cpp:
#include "mainwindow.h"
#include "onlinedb.h"
void MainWindow::on_ViewDatabase_clicked()
{
OnlineDB dlg(this);
dlg.exec();
}
onlinedb.h:
#ifndef OnlineDB_H
#define OnlineDB_H
#include "ui_onlinedb.h"
#include <QDialog>
class MainWindow;
class OnlineDB : public QDialog, public Ui::OnlineDB
{
Q_OBJECT
public:
OnlineDB(LkMainWindow *parent);
~OnlineDB();
private:
MainWindow *MainWindow;
};
#endif
onlinedb.cpp:
#include "onlinedb.h"
#include "mainwindow.h"
///////////////////////////////////////////////////////////////////////////////
//
// OnlineDB class constructor
//
// Create a OnlineDB
//
OnlineDB::OnlineDB(MainWindow *parent) : QDialog(parent), MainWindow(parent)
{
setupUi(this);
QUrl url("http://google.com"); //whatever
webView->load(url);
}
///////////////////////////////////////////////////////////////////////////////
//
// OnlineDB class destructor
//
// Clean up the OnlineDB
//
OnlineDB::~OnlineDB()
{
}
I got several linking errors
Plz can someone help on that?
3>Linking...
3>onlinedb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebView::load(class QUrl const &)" (__imp_?load#QWebView##QAEXABVQUrl###Z) referenced in function "public: __thiscall OnlineDB::OnlineDB(class LkMainWindow *)" (??0OnlineDB##QAE#PAVLkMainWindow###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall OnlineDB::metaObject(void)const " (?metaObject#OnlineDB##UBEPBUQMetaObject##XZ)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall OnlineDB::qt_metacast(char const *)" (?qt_metacast#OnlineDB##UAEPAXPBD#Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall OnlineDB::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#OnlineDB##UAEHW4Call#QMetaObject##HPAPAX#Z)
3>onlinedb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebView::setUrl(class QUrl const &)" (__imp_?setUrl#QWebView##QAEXABVQUrl###Z) referenced in function "public: void __thiscall Ui_OnlineDB::setupUi(class QDialog *)" (?setupUi#Ui_OnlineDB##QAEXPAVQDialog###Z)
3>onlinedb.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_OnlineDB::setupUi(class QDialog *)" (?setupUi#Ui_OnlineDB##QAEXPAVQDialog###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QWebView::metaObject(void)const " (?metaObject#QWebView##UBEPBUQMetaObject##XZ)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QWebView::qt_metacast(char const *)" (?qt_metacast#QWebView##UAEPAXPBD#Z)
3>onlinedb.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)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QWebView::event(class QEvent *)" (?event#QWebView##UAE_NPAVQEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __thiscall QWebView::sizeHint(void)const " (?sizeHint#QWebView##UBE?AVQSize##XZ)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mousePressEvent(class QMouseEvent *)" (?mousePressEvent#QWebView##MAEXPAVQMouseEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent#QWebView##MAEXPAVQMouseEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent#QWebView##MAEXPAVQMouseEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent#QWebView##MAEXPAVQMouseEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::wheelEvent(class QWheelEvent *)" (?wheelEvent#QWebView##MAEXPAVQWheelEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::keyPressEvent(class QKeyEvent *)" (?keyPressEvent#QWebView##MAEXPAVQKeyEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent#QWebView##MAEXPAVQKeyEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::focusInEvent(class QFocusEvent *)" (?focusInEvent#QWebView##MAEXPAVQFocusEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::focusOutEvent(class QFocusEvent *)" (?focusOutEvent#QWebView##MAEXPAVQFocusEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::paintEvent(class QPaintEvent *)" (?paintEvent#QWebView##MAEXPAVQPaintEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::resizeEvent(class QResizeEvent *)" (?resizeEvent#QWebView##MAEXPAVQResizeEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent#QWebView##MAEXPAVQContextMenuEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent#QWebView##MAEXPAVQDragEnterEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent#QWebView##MAEXPAVQDragMoveEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent#QWebView##MAEXPAVQDragLeaveEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dropEvent(class QDropEvent *)" (?dropEvent#QWebView##MAEXPAVQDropEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::changeEvent(class QEvent *)" (?changeEvent#QWebView##MAEXPAVQEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::inputMethodEvent(class QInputMethodEvent *)" (?inputMethodEvent#QWebView##MAEXPAVQInputMethodEvent###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QWebView::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery#QWebView##UBE?AVQVariant##W4InputMethodQuery#Qt###Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QWebView::focusNextPrevChild(bool)" (?focusNextPrevChild#QWebView##MAE_N_N#Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual class QWebView * __thiscall QWebView::createWindow(enum QWebPage::WebWindowType)" (?createWindow#QWebView##MAEPAV1#W4WebWindowType#QWebPage###Z)
3>onlinedb.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)
unresolved external symbol "public: virtual int __thiscall OnlineDB::qt_metacall(enum QMetaObject::Call,int,void * *)
You have not moc'd your OnlineDB or you have not linked the objectfile.
error LNK2019: unresolved external symbol "__declspec(dllimport) public: void _thiscall QWebView::load(class QUrl const &)"
You have not linked against all the necessary Qt libraries. QWebView is in the QtWebKit library.

How to get VS2008 to use __cdecl rather than __thiscall in C++ project?

I am trying to build an open source C++ project in Visual Studio 2008. I load the solution file and everything compiles, but I'm getting a bunch of linking errors due to certain methods not being found. After using DUMPBIN.EXE to examine the .lib file in question, I can see what the problem is: the methods in the .lib all have __cdecl in their signatures, while the linker is looking for the equivalent methods with __thiscall instead.
How can I get VS 2008 to use __cdecl instead?
NOTE: The project is a fork of CCV, a multi-touch tracking program based on OpenCV. The purpose of this fork is to provide support for a camera called the Flea3 via the FlyCapture2 libraries provided by the camera's maker. Here are the linker errors:
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::Image::Image(void)" (__imp_??0Image#FlyCapture2##QAE#XZ) referenced in function "public: __thiscall ofxFlea3::ofxFlea3(void)" (??0ofxFlea3##QAE#XZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall FlyCapture2::Image::~Image(void)" (__imp_??1Image#FlyCapture2##UAE#XZ) referenced in function "public: __thiscall ofxFlea3::ofxFlea3(void)" (??0ofxFlea3##QAE#XZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::Camera::Camera(void)" (__imp_??0Camera#FlyCapture2##QAE#XZ) referenced in function "public: __thiscall ofxFlea3::ofxFlea3(void)" (??0ofxFlea3##QAE#XZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall FlyCapture2::Camera::~Camera(void)" (__imp_??1Camera#FlyCapture2##UAE#XZ) referenced in function "public: __thiscall ofxFlea3::ofxFlea3(void)" (??0ofxFlea3##QAE#XZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall FlyCapture2::Error::~Error(void)" (__imp_??1Error#FlyCapture2##UAE#XZ) referenced in function "void __cdecl PrintError(class FlyCapture2::Error)" (?PrintError##YAXVError#FlyCapture2###Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall FlyCapture2::Error::PrintErrorTrace(void)const " (__imp_?PrintErrorTrace#Error#FlyCapture2##UBEXXZ) referenced in function "void __cdecl PrintError(class FlyCapture2::Error)" (?PrintError##YAXVError#FlyCapture2###Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual class FlyCapture2::Error __thiscall FlyCapture2::BusManager::GetCameraFromIndex(unsigned int,class FlyCapture2::PGRGuid *)" (__imp_?GetCameraFromIndex#BusManager#FlyCapture2##UAE?AVError#2#IPAVPGRGuid#2##Z) referenced in function "public: void __thiscall ofxFlea3::listDevices(void)" (?listDevices#ofxFlea3##QAEXXZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall FlyCapture2::BusManager::~BusManager(void)" (__imp_??1BusManager#FlyCapture2##UAE#XZ) referenced in function "public: void __thiscall ofxFlea3::listDevices(void)" (?listDevices#ofxFlea3##QAEXXZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::Error::Error(class FlyCapture2::Error const &)" (__imp_??0Error#FlyCapture2##QAE#ABV01##Z) referenced in function "public: void __thiscall ofxFlea3::listDevices(void)" (?listDevices#ofxFlea3##QAEXXZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual class FlyCapture2::Error __thiscall FlyCapture2::BusManager::GetNumOfCameras(unsigned int *)" (__imp_?GetNumOfCameras#BusManager#FlyCapture2##UAE?AVError#2#PAI#Z) referenced in function "public: void __thiscall ofxFlea3::listDevices(void)" (?listDevices#ofxFlea3##QAEXXZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::Error::Error(void)" (__imp_??0Error#FlyCapture2##QAE#XZ) referenced in function "public: void __thiscall ofxFlea3::listDevices(void)" (?listDevices#ofxFlea3##QAEXXZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::BusManager::BusManager(void)" (__imp_??0BusManager#FlyCapture2##QAE#XZ) referenced in function "public: void __thiscall ofxFlea3::listDevices(void)" (?listDevices#ofxFlea3##QAEXXZ)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual class FlyCapture2::Error __thiscall FlyCapture2::Image::Save(char const *,enum FlyCapture2::ImageFileFormat)" (__imp_?Save#Image#FlyCapture2##UAE?AVError#2#PBDW4ImageFileFormat#2##Z) referenced in function "public: void __thiscall ofxFlea3::initFlea3(int,int,int,int)" (?initFlea3#ofxFlea3##QAEXHHHH#Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual class FlyCapture2::Error __thiscall FlyCapture2::Image::Convert(enum FlyCapture2::PixelFormat,class FlyCapture2::Image *)const " (__imp_?Convert#Image#FlyCapture2##UBE?AVError#2#W4PixelFormat#2#PAV12##Z) referenced in function "public: void __thiscall ofxFlea3::initFlea3(int,int,int,int)" (?initFlea3#ofxFlea3##QAEXHHHH#Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual class FlyCapture2::Error __thiscall FlyCapture2::Image::ReleaseBuffer(void)" (__imp_?ReleaseBuffer#Image#FlyCapture2##UAE?AVError#2#XZ) referenced in function "protected: virtual void __thiscall ofxFlea3::getNewFrame(unsigned char *)" (?getNewFrame#ofxFlea3##MAEXPAE#Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual struct FlyCapture2::TimeStamp __thiscall FlyCapture2::Image::GetTimeStamp(void)const " (__imp_?GetTimeStamp#Image#FlyCapture2##UBE?AUTimeStamp#2#XZ) referenced in function "protected: virtual void __thiscall ofxFlea3::getNewFrame(unsigned char *)" (?getNewFrame#ofxFlea3##MAEXPAE#Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual unsigned char * __thiscall FlyCapture2::Image::GetData(void)" (__imp_?GetData#Image#FlyCapture2##UAEPAEXZ) referenced in function "protected: virtual void __thiscall ofxFlea3::getNewFrame(unsigned char *)" (?getNewFrame#ofxFlea3##MAEXPAE#Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual unsigned int __thiscall FlyCapture2::Image::GetDataSize(void)const " (__imp_?GetDataSize#Image#FlyCapture2##UBEIXZ) referenced in function "protected: virtual void __thiscall ofxFlea3::getNewFrame(unsigned char *)" (?getNewFrame#ofxFlea3##MAEXPAE#Z)
1>ofxFlea3.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall FlyCapture2::Image::GetDimensions(unsigned int *,unsigned int *,unsigned int *,enum FlyCapture2::PixelFormat *,enum FlyCapture2::BayerTileFormat *)const " (__imp_?GetDimensions#Image#FlyCapture2##UBEXPAI00PAW4PixelFormat#2#PAW4BayerTileFormat#2##Z) referenced in function "protected: virtual void __thiscall ofxFlea3::getNewFrame(unsigned char *)" (?getNewFrame#ofxFlea3##MAEXPAE#Z)
By default Visual Studio will use __thiscall for member functions. Since it compiles correctly, it seems like the headers in your library do not explicitly declare the calling convention.
It sounds like you need to use C linkage against the library. Try wrapping the library headers with
extern "C" { }
The problem was that I was linking against the 64-bit version of the external FlyCapture2 library. Switching to the 32-bit version solved the problem.