Compiling IBPP with VS2010 - linking issue - visual-studio-2010

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).

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
...)

unable to compile PgAdmin3

these errors are coming when compiling in release and X64..
Error 320 error LNK2019: unresolved external symbol xsltCleanupGlobals referenced in function "private: class wxString __cdecl frmReport::XslProcessReport(class wxString const &,class wxString const &)" (?XslProcessReport#frmReport##AEAA?AVwxString##AEBV2#0#Z) C:\Newfolder\pgadmin3-1.20.0\pgadmin\frmReport.obj pgAdmin3
Error 321 error LNK2019: unresolved external symbol xsltFreeStylesheet referenced in function "private: class wxString __cdecl frmReport::XslProcessReport(class wxString const &,class wxString const &)" (?XslProcessReport#frmReport##AEAA?AVwxString##AEBV2#0#Z) C:\Newfolder\pgadmin3-1.20.0\pgadmin\frmReport.obj pgAdmin3
Error 322 error LNK2019: unresolved external symbol xsltParseStylesheetDoc referenced in function "private: class wxString __cdecl frmReport::XslProcessReport(class wxString const &,class wxString const &)" (?XslProcessReport#frmReport##AEAA?AVwxString##AEBV2#0#Z) C:\Newfolder\pgadmin3-1.20.0\pgadmin\frmReport.obj pgAdmin3
Error 323 error LNK2019: unresolved external symbol xsltApplyStylesheet referenced in function "private: class wxString __cdecl frmReport::XslProcessReport(class wxString const &,class wxString const &)" (?XslProcessReport#frmReport##AEAA?AVwxString##AEBV2#0#Z) C:\Newfolder\pgadmin3-1.20.0\pgadmin\frmReport.obj pgAdmin3
Error 324 error LNK2019: unresolved external symbol xsltSaveResultToString referenced in function "private: class wxString __cdecl frmReport::XslProcessReport(class wxString const &,class wxString const &)" (?XslProcessReport#frmReport##AEAA?AVwxString##AEBV2#0#Z) C:\Newfolder\pgadmin3-1.20.0\pgadmin\frmReport.obj pgAdmin3
Error 325 error LNK1120: 5 unresolved externals C:\Newfolder\pgadmin3-1.20.0\pgadmin\Release\pgAdmin3.exe pgAdmin3
added linker settings and also vc++ directory settings still the above errors are coming. please do needful, to generate pgAdmin3.exe in release folder.
The above error is because of linking an invalid libxslt.lib file, it got fixed by changing that linked libxslt.lib to correct 64bit file.

QT5 QWebView linker errors

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.

Relinking to a modified DLL in another solution in Visual Studio 2010

I coded a BitPacker object that takes in various types of data and packs them to a buffer using the fewest number of bits required to store their values. I created a separate solution to make this into a DLL for reuse-ability. I was successfully able to link to it from another solution and use it. However I ran into the problem of these two function prototypes in the DLL being ambiguous when trying to pass in a long long for "data" instead of an int:
static __declspec(dllexport) unsigned long long UnpackBits(char *srcBuffer, long long data, unsigned int &offsetBits, const unsigned int numBits);
static __declspec(dllexport) unsigned int UnpackBits(char *srcBuffer, int data, unsigned int &offsetBits, const unsigned int numBits);
static __declspec(dllexport) float UnpackBits(char *srcBuffer, float data, unsigned int &offsetBits);
There is no problem when I'm simply passing an int. Since I can't think of a way to remove the ambiguity to support both data types I decided to modify the DLL source by commenting out the "long long" versions from the header and source files and recompiling them (both for Debug and Release). However after doing that I'm receiving linker errors for pretty much every call to that DLL now. I don't know why since I also changed the instances of where I was using a long long data member to int to make sure there was no reference to the old long long version that I commented out.
1>ChessGame.obj : error LNK2019: unresolved external symbol "public: static unsigned int __cdecl BitPacker::UnpackBits(char *,int,unsigned int &,unsigned int)" (?UnpackBits#BitPacker##SAIPADHAAII#Z) referenced in function "public: class ChessGame * __thiscall ChessGame::LoadGame(char const *)" (?LoadGame#ChessGame##QAEPAV1#PBD#Z)
1>Date.obj : error LNK2001: unresolved external symbol "public: static unsigned int __cdecl BitPacker::UnpackBits(char *,int,unsigned int &,unsigned int)" (?UnpackBits#BitPacker##SAIPADHAAII#Z)
1>Turn.obj : error LNK2001: unresolved external symbol "public: static unsigned int __cdecl BitPacker::UnpackBits(char *,int,unsigned int &,unsigned int)" (?UnpackBits#BitPacker##SAIPADHAAII#Z)
1>ChessGame.obj : error LNK2019: unresolved external symbol "public: static int __cdecl BitPacker::ReadFile(char const *,char *,int)" (?ReadFile#BitPacker##SAHPBDPADH#Z) referenced in function "public: class ChessGame * __thiscall ChessGame::LoadGame(char const *)" (?LoadGame#ChessGame##QAEPAV1#PBD#Z)
1>ChessGame.obj : error LNK2019: unresolved external symbol "public: static int __cdecl BitPacker::FileSize(char const *)" (?FileSize#BitPacker##SAHPBD#Z) referenced in function "public: class ChessGame * __thiscall ChessGame::LoadGame(char const *)" (?LoadGame#ChessGame##QAEPAV1#PBD#Z)
1>ChessGame.obj : error LNK2019: unresolved external symbol "public: static void __cdecl BitPacker::PackBits(char *,int,unsigned int &,unsigned int)" (?PackBits#BitPacker##SAXPADHAAII#Z) referenced in function "public: int __thiscall ChessGame::SaveGame(char const *)" (?SaveGame#ChessGame##QAEHPBD#Z)
1>Date.obj : error LNK2001: unresolved external symbol "public: static void __cdecl BitPacker::PackBits(char *,int,unsigned int &,unsigned int)" (?PackBits#BitPacker##SAXPADHAAII#Z)
1>Turn.obj : error LNK2001: unresolved external symbol "public: static void __cdecl BitPacker::PackBits(char *,int,unsigned int &,unsigned int)" (?PackBits#BitPacker##SAXPADHAAII#Z)
1>ChessGame.obj : error LNK2019: unresolved external symbol "public: static int __cdecl BitPacker::CopyBits(char *,char *,unsigned int &,unsigned int &,unsigned int)" (?CopyBits#BitPacker##SAHPAD0AAI1I#Z) referenced in function "public: int __thiscall ChessGame::SaveGame(char const *)" (?SaveGame#ChessGame##QAEHPBD#Z)
1>Turn.obj : error LNK2001: unresolved external symbol "public: static int __cdecl BitPacker::CopyBits(char *,char *,unsigned int &,unsigned int &,unsigned int)" (?CopyBits#BitPacker##SAHPAD0AAI1I#Z)
1>ChessGameManager.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl BitPacker::FileExists(char const *)" (?FileExists#BitPacker##SA_NPBD#Z) referenced in function "public: void __thiscall ChessGameManager::RenderGameMenuIcons(void)" (?RenderGameMenuIcons#ChessGameManager##QAEXXZ)
1>C:\Users\rvandyke\Documents\Visual Studio 2010\Projects\SuperChessW32_v003\Debug\SuperChessW32_v003.exe : fatal error LNK1120: 6 unresolved externals
I tried cleaning the calling project, manually deleting all the object files and doing a Rebuild All but the errors remain. I'm thinking it is somehow still using an old version of the DLL header file and/or lib but don't know how or why. Is there something I need to do in my calling Solution for it to "re recognize" the new DLL?
PS - And while I'm asking anyone have any advice on the ambiguity problem? I'd like to be able to support both 32 and 64 bit data types but not sure how. I thought about simply getting rid of the int version and only having the long long version but then I worry about the possibility of data becoming truncated when catching the return type back into an int.

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