I modified an existing class in my visual C++ application to make it a generic class. This class is used by two other modules. When I compile these modules separately everything works. However, when I do a Build All, I get these linker errors:
1>Linking...
1> Creating library C:\ccmdb\prep\g3_v5.3\g3_tools\fc_tools\ZFRTool\ZStackMTI\Debug\ZStackMTI.lib and object C:\ccmdb\prep\g3_v5.3\g3_tools\fc_tools\ZFRTool\ZStackMTI\Debug\ZStackMTI.exp
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: __thiscall CRingBuffer<unsigned char>::CRingBuffer<unsigned char>(unsigned long)" (??0?$CRingBuffer#E##QAE#K#Z) referenced in function "public: __thiscall CSerialPort::CSerialPort(void)" (??0CSerialPort##QAE#XZ)
1>ZStackMTI.obj : error LNK2001: unresolved external symbol "public: __thiscall CRingBuffer<unsigned char>::CRingBuffer<unsigned char>(unsigned long)" (??0?$CRingBuffer#E##QAE#K#Z)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: __thiscall CRingBuffer<unsigned char>::~CRingBuffer<unsigned char>(void)" (??1?$CRingBuffer#E##QAE#XZ) referenced in function "public: void * __thiscall CRingBuffer<unsigned char>::`scalar deleting destructor'(unsigned int)" (??_G?$CRingBuffer#E##QAEPAXI#Z)
1>ZStackMTI.obj : error LNK2001: unresolved external symbol "public: __thiscall CRingBuffer<unsigned char>::~CRingBuffer<unsigned char>(void)" (??1?$CRingBuffer#E##QAE#XZ)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall CRingBuffer<unsigned char>::GetBufferItems(void)" (?GetBufferItems#?$CRingBuffer#E##QAEKXZ) referenced in function "public: unsigned long __thiscall CSerialPort::GetBufferedRxItems(void)" (?GetBufferedRxItems#CSerialPort##QAEKXZ)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Peek(unsigned char *,unsigned long,unsigned long *)" (?Peek#?$CRingBuffer#E##QAEHPAEKPAK#Z) referenced in function "public: unsigned long __thiscall CSerialPort::Peek(unsigned char *,unsigned long,unsigned long *)" (?Peek#CSerialPort##QAEKPAEKPAK#Z)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Remove(unsigned char *,unsigned long,unsigned long *)" (?Remove#?$CRingBuffer#E##QAEHPAEKPAK#Z) referenced in function "public: unsigned long __thiscall CSerialPort::Read(unsigned char *,unsigned long,unsigned long *)" (?Read#CSerialPort##QAEKPAEKPAK#Z)
1>ZStackMTI.obj : error LNK2001: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Remove(unsigned char *,unsigned long,unsigned long *)" (?Remove#?$CRingBuffer#E##QAEHPAEKPAK#Z)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Add(unsigned char *,unsigned long,int)" (?Add#?$CRingBuffer#E##QAEHPAEKH#Z) referenced in function "public: unsigned long __thiscall CSerialPort::Write(unsigned char *,unsigned long)" (?Write#CSerialPort##QAEKPAEK#Z)
1>ZStackMTI.obj : error LNK2001: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Add(unsigned char *,unsigned long,int)" (?Add#?$CRingBuffer#E##QAEHPAEKH#Z)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Delete(unsigned long)" (?Delete#?$CRingBuffer#E##QAEHK#Z) referenced in function "public: unsigned long __thiscall CSerialPort::Delete(unsigned long,int)" (?Delete#CSerialPort##QAEKKH#Z)
1>SerialPort.obj : error LNK2019: unresolved external symbol "public: int __thiscall CRingBuffer<unsigned char>::Flush(void)" (?Flush#?$CRingBuffer#E##QAEHXZ) referenced in function "public: unsigned long __thiscall CSerialPort::Flush(int)" (?Flush#CSerialPort##QAEKH#Z)
1>ZStackMTI.obj : error LNK2019: unresolved external symbol "public: unsigned char __thiscall CRingBuffer<unsigned char>::Peek(unsigned long)" (?Peek#?$CRingBuffer#E##QAEEK#Z) referenced in function "unsigned long __cdecl ZBNConnect_GetExtAddr(unsigned char *)" (?ZBNConnect_GetExtAddr##YAKPAE#Z)
1>C:\ccmdb\prep\g3_v5.3\g3_tools\fc_tools\ZFRTool\ZStackMTI\Debug\ZStackMTI.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://c:\ccmdb\prep\g3_v5.3\g3_tools\fc_tools\ZFRTool\ZStackMTI\ZStackMTI\Debug\BuildLog.htm"
1>ZStackMTI - 14 error(s), 0 warning(s)
I am using Visual Studio 2008. Does anyone know how to fix this? Prior to the modifications, everything built and linked without any problems. Thanks.
Implement your template functions in the header file.
The compiler needs to see the entire class template when it creates an actual class from the template. See e.g. Why should the implementation and the declaration of a template class be in the same header file?
This can be because the linker can't find the method bodies of your concrete class.
One workaround is to include the actual .cpp file instead of the .h file when you use declare the concrete instances of your templated classes.
Related
Trying to make a program cross-platform, QT is required to be linked statically. I am struggling with dependencies.
After several hours researching, I managed to get the dependencies missing down to the following errors, for which I could not find much information around.
As an additional information, I could not include Qt5PlatformSupport, which does not seems to exists in Qt 5.12.2
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: static class QWindowsUiaWrapper * __cdecl QWindowsUiaWrapper::instance(void)" (?instance#QWindowsUiaWrapper##SAPAV1#XZ) referenced in function "public: static bool __cdecl QWindowsUiaAccessibility::handleWmGetObject(struct HWND__ *,unsigned int,long,long *)" (?handleWmGetObject#QWindowsUiaAccessibility##SA_NPAUHWND__##IJPAJ#Z)
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: int __thiscall QWindowsUiaWrapper::ready(void)" (?ready#QWindowsUiaWrapper##QAEHXZ) referenced in function "public: virtual void __thiscall QWindowsUiaAccessibility::notifyAccessibilityUpdate(class QAccessibleEvent *)" (?notifyAccessibilityUpdate#QWindowsUiaAccessibility##UAEXPAVQAccessibleEvent###Z)
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: int __thiscall QWindowsUiaWrapper::clientsAreListening(void)" (?clientsAreListening#QWindowsUiaWrapper##QAEHXZ) referenced in function "public: virtual void __thiscall QWindowsUiaAccessibility::notifyAccessibilityUpdate(class QAccessibleEvent *)" (?notifyAccessibilityUpdate#QWindowsUiaAccessibility##UAEXPAVQAccessibleEvent###Z)
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::returnRawElementProvider(struct HWND__ *,unsigned int,long,struct IRawElementProviderSimple *)" (?returnRawElementProvider#QWindowsUiaWrapper##QAEJPAUHWND__##IJPAUIRawElementProviderSimple###Z) referenced in function "public: static bool __cdecl QWindowsUiaAccessibility::handleWmGetObject(struct HWND__ *,unsigned int,long,long *)" (?handleWmGetObject#QWindowsUiaAccessibility##SA_NPAUHWND__##IJPAJ#Z)
qwindowsd.lib(qwindowsuiamainprovider.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::hostProviderFromHwnd(struct HWND__ *,struct IRawElementProviderSimple * *)" (?hostProviderFromHwnd#QWindowsUiaWrapper##QAEJPAUHWND__##PAPAUIRawElementProviderSimple###Z) referenced in function "public: virtual long __stdcall QWindowsUiaMainProvider::get_HostRawElementProvider(struct IRawElementProviderSimple * *)" (?get_HostRawElementProvider#QWindowsUiaMainProvider##UAGJPAPAUIRawElementProviderSimple###Z)
qwindowsd.lib(qwindowsuiamainprovider.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::raiseAutomationPropertyChangedEvent(struct IRawElementProviderSimple *,int,struct tagVARIANT,struct tagVARIANT)" (?raiseAutomationPropertyChangedEvent#QWindowsUiaWrapper##QAEJPAUIRawElementProviderSimple##HUtagVARIANT##1#Z) referenced in function "public: static void __cdecl QWindowsUiaMainProvider::notifyStateChange(class QAccessibleStateChangeEvent *)" (?notifyStateChange#QWindowsUiaMainProvider##SAXPAVQAccessibleStateChangeEvent###Z)
qwindowsd.lib(qwindowsuiamainprovider.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::raiseAutomationEvent(struct IRawElementProviderSimple *,int)" (?raiseAutomationEvent#QWindowsUiaWrapper##QAEJPAUIRawElementProviderSimple##H#Z) referenced in function "public: static void __cdecl QWindowsUiaMainProvider::notifyFocusChange(class QAccessibleEvent *)" (?notifyFocusChange#QWindowsUiaMainProvider##SAXPAVQAccessibleEvent###Z)
What library is required to fulfill those symbols?
Helpful questions related to this, which did not help:
QT 5.6 static unresolved external symbol
Statically linked app with Qt gives error: Failed to load platform plugin "windows"
Qt static linking and deployment
I use a smaller list of libraries, you may refer to it:
Qt5Core.lib
Qt5Gui.lib
Qt5Widgets.lib
Qt5ThemeSupport.lib
Qt5WindowsUiAutomationSupport.lib
Qt5EventDispatcherSupport.lib
Qt5FontDatabaseSupport.lib
qtmain.lib
qwindows.lib
qtpcre2.lib
qtlibpng.lib
qtharfbuzz.lib
Ws2_32.lib
Imm32.lib
WinMM.lib
Version.lib
Netapi32.lib
Userenv.lib
Dwmapi.lib
Simple and stupid: I was missing the Qt5WindowsUIAutomationSupport library.
I keep it as answer if anybody face the same issue.
In general, I had to include following libraries:
Qt5AccessibilitySupport
Qt5WindowsUiAutomationSupport
Qt5ThemeSupport
Qt5FontDatabaseSupport
qtpre2
qtharfbuzz
qtlibpng
qtfreetype
Qt5EventDispatcherSupport
Dwmapi
imm32
netapi32
wtsapi32
winmm
zlib
bcrypt
version
userenv
And additionally, it is required to startup the platform plugins before the QApplication creation:
#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
I've been trying to build using static qt for a while but i can't get rid of these errors .
<QtGuiApplication4> (29 items)
Error LNK2019: unresolved external symbol _FT_New_Face referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" (?addTTFile#QBasicFontDatabase##SA?AVQStringList##ABVQByteArray##0#Z)
Error LNK2019: unresolved external symbol _FT_Get_PS_Font_Info referenced in function "public: bool __thiscall QFontEngineFT::init(struct QFontEngine::FaceId,bool,enum QFontEngine::GlyphFormat,class QFreetypeFace *)" (?init#QFontEngineFT##QAE_NUFaceId#QFontEngine##_NW4GlyphFormat#3#PAVQFreetypeFace###Z)
Error LNK2019: unresolved external symbol _FT_Load_Sfnt_Table referenced in function "bool __cdecl ft_getSfntTable(void *,unsigned int,unsigned char *,unsigned int *)" (?ft_getSfntTable##YA_NPAXIPAEPAI#Z)
Error LNK2019: unresolved external symbol _FT_GlyphSlot_Oblique referenced in function "public: virtual void __thiscall QFontEngineFT::addGlyphsToPath(unsigned int *,struct QFixedPoint *,int,class QPainterPath *,class QFlags<enum QTextItem::RenderFlag>)" (?addGlyphsToPath#QFontEngineFT##UAEXPAIPAUQFixedPoint##HPAVQPainterPath##V?$QFlags#W4RenderFlag#QTextItem#####Z)
Error LNK2019: unresolved external symbol _FT_GlyphSlot_Embolden referenced in function "public: virtual void __thiscall QFontEngineFT::addGlyphsToPath(unsigned int *,struct QFixedPoint *,int,class QPainterPath *,class QFlags<enum QTextItem::RenderFlag>)" (?addGlyphsToPath#QFontEngineFT##UAEXPAIPAUQFixedPoint##HPAVQPainterPath##V?$QFlags#W4RenderFlag#QTextItem#####Z)
Error LNK2019: unresolved external symbol _FT_Outline_Get_Bitmap referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " (?loadGlyph#QFontEngineFT##QBEPAUGlyph#1#PAUQGlyphSet#1#IUQFixed##W4GlyphFormat#QFontEngine##_N#Z)
Error LNK2019: unresolved external symbol _FT_Outline_Transform referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " (?loadGlyph#QFontEngineFT##QBEPAUGlyph#1#PAUQGlyphSet#1#IUQFixed##W4GlyphFormat#QFontEngine##_N#Z)
Error LNK2019: unresolved external symbol _FT_Outline_Translate referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " (?loadGlyph#QFontEngineFT##QBEPAUGlyph#1#PAUQGlyphSet#1#IUQFixed##W4GlyphFormat#QFontEngine##_N#Z)
Error LNK2019: unresolved external symbol _FT_Vector_Transform referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " (?loadGlyph#QFontEngineFT##QBEPAUGlyph#1#PAUQGlyphSet#1#IUQFixed##W4GlyphFormat#QFontEngine##_N#Z)
Error LNK2019: unresolved external symbol _FT_MulFix referenced in function "public: bool __thiscall QFontEngineFT::init(struct QFontEngine::FaceId,bool,enum QFontEngine::GlyphFormat,class QFreetypeFace *)" (?init#QFontEngineFT##QAE_NUFaceId#QFontEngine##_NW4GlyphFormat#3#PAVQFreetypeFace###Z)
Error LNK2019: unresolved external symbol _FT_MulDiv referenced in function "void __cdecl scaleOutline(struct FT_FaceRec_ *,struct FT_GlyphSlotRec_ *,long,long)" (?scaleOutline##YAXPAUFT_FaceRec_##PAUFT_GlyphSlotRec_##JJ#Z)
Error LNK2019: unresolved external symbol _FT_Get_Char_Index referenced in function "public: virtual unsigned int __thiscall QFontEngineFT::glyphIndex(unsigned int)const " (?glyphIndex#QFontEngineFT##UBEII#Z)
Error LNK2019: unresolved external symbol _FT_Set_Charmap referenced in function "public: static class QFreetypeFace * __cdecl QFreetypeFace::getFace(struct QFontEngine::FaceId const &,class QByteArray const &)" (?getFace#QFreetypeFace##SAPAV1#ABUFaceId#QFontEngine##ABVQByteArray###Z)
Error LNK2019: unresolved external symbol _FT_Matrix_Multiply referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " (?loadGlyph#QFontEngineFT##QBEPAUGlyph#1#PAUQGlyphSet#1#IUQFixed##W4GlyphFormat#QFontEngine##_N#Z)
Error LNK2019: unresolved external symbol _FT_Get_Postscript_Name referenced in function "public: struct QFontEngine::Properties __thiscall QFreetypeFace::properties(void)const " (?properties#QFreetypeFace##QBE?AUProperties#QFontEngine##XZ)
Error LNK2019: unresolved external symbol _FT_Load_Glyph referenced in function "public: virtual void __thiscall QFontEngineFT::addGlyphsToPath(unsigned int *,struct QFixedPoint *,int,class QPainterPath *,class QFlags<enum QTextItem::RenderFlag>)" (?addGlyphsToPath#QFontEngineFT##UAEXPAIPAUQFixedPoint##HPAVQPainterPath##V?$QFlags#W4RenderFlag#QTextItem#####Z)
Error LNK2019: unresolved external symbol _FT_Set_Char_Size referenced in function "public: static class QFreetypeFace * __cdecl QFreetypeFace::getFace(struct QFontEngine::FaceId const &,class QByteArray const &)" (?getFace#QFreetypeFace##SAPAV1#ABUFaceId#QFontEngine##ABVQByteArray###Z)
Error LNK2019: unresolved external symbol _FT_Select_Size referenced in function "public: void __thiscall QFreetypeFace::computeSize(struct QFontDef const &,int *,int *,bool *)" (?computeSize#QFreetypeFace##QAEXABUQFontDef##PAH1PA_N#Z)
Error LNK2019: unresolved external symbol _FT_Done_FreeType referenced in function "public: __thiscall QtFreetypeData::~QtFreetypeData(void)" (??1QtFreetypeData##QAE#XZ)
Error LNK2019: unresolved external symbol _FT_Init_FreeType referenced in function "public: static class QFreetypeFace * __cdecl QFreetypeFace::getFace(struct QFontEngine::FaceId const &,class QByteArray const &)" (?getFace#QFreetypeFace##SAPAV1#ABUFaceId#QFontEngine##ABVQByteArray###Z)
Error LNK2001: unresolved external symbol _FT_Get_Sfnt_Table
Error LNK2019: unresolved external symbol _FT_Get_Sfnt_Table referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" (?addTTFile#QBasicFontDatabase##SA?AVQStringList##ABVQByteArray##0#Z)
Error LNK2001: unresolved external symbol _FT_Done_Face
Error LNK2019: unresolved external symbol _FT_Done_Face referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" (?addTTFile#QBasicFontDatabase##SA?AVQStringList##ABVQByteArray##0#Z)
Error LNK2001: unresolved external symbol _FT_New_Memory_Face
Error LNK2019: unresolved external symbol _FT_New_Memory_Face referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" (?addTTFile#QBasicFontDatabase##SA?AVQStringList##ABVQByteArray##0#Z)
Error LNK2001: unresolved external symbol _FT_New_Face
Error LNK2019: unresolved external symbol _FT_Set_Transform referenced in function "public: virtual void __thiscall QFontEngineFT::getUnscaledGlyph(unsigned int,class QPainterPath *,struct glyph_metrics_t *)" (?getUnscaledGlyph#QFontEngineFT##UAEXIPAVQPainterPath##PAUglyph_metrics_t###Z)
Error LNK1120: 24 unresolved externals
I am using these libraries :
ws2_32.lib
imm32.lib
winmm.lib
qtharfbuzzng.lib
qtpcre.lib
Qt5PlatformSupport.lib
qwindows.lib
opengl32.lib
Can any of you explain me what i am doing wrong ? Thank you.
I've had the exact same issue. You're missing the freetype library qtfreetype.lib.
Add the following line to your .pro file
LIBS += -lqtfreetype
You need QtCore and QtGui at a minimum for this. QString is in QtCore and QGuiApplication is in QtGui. If your Qt usage is restricted to user interface activities, that might be enough. Otherwise, for each class that's failing to link, look in Qt Assistant. The "qmake" note at the top of the page says which library contains that class.
For instance, for Qstring, it has "qmake: QT += core". For Visual Studio on Windows, the actual filenames for the "core" library are Qt5Core.dll (release) Qt5Cored.dll (debug).
Added my case, hope this will helpful.
I'm lost one CPP file in the library project
Be careful when compilation (Lib & Project) has different option MT/MD options
I am trying to build OSGEarth using CMAKE and Visual studio 2013
I first downloaded Open Scene Graph 3.2 and the prebuild dependencies (small package) from this page. I generated the visual studio 2013 project and build/installed Open Scene Graph without much problem
After that, I downloaded the source of osgearth 2.5 and generated the Visual Studio 2013 project, using the same dependencies as for Open Scene Graph (I don't want to use the optional dependencies for the first build) and when I try to build the osgEarth project, I got the following error at the linking step :
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLAllocConnect#8 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession#CPLODBCSession##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLAllocEnv#4 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession#CPLODBCSession##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLAllocStmt#8 referenced in function "public: __thiscall CPLODBCStatement::CPLODBCStatement(class CPLODBCSession *)" (??0CPLODBCStatement##QAE#PAVCPLODBCSession###Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLColAttribute#28 referenced in function "public: int __thiscall CPLODBCStatement::CollectResultsInfo(void)" (?CollectResultsInfo#CPLODBCStatement##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLColumns#36 referenced in function "public: int __thiscall CPLODBCStatement::GetColumns(char const *,char const *,char const *)" (?GetColumns#CPLODBCStatement##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLConnect#28 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession#CPLODBCSession##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLDescribeCol#36 referenced in function "public: int __thiscall CPLODBCStatement::CollectResultsInfo(void)" (?CollectResultsInfo#CPLODBCStatement##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLDisconnect#4 referenced in function "public: int __thiscall CPLODBCSession::CloseSession(void)" (?CloseSession#CPLODBCSession##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLEndTran#12 referenced in function "public: int __thiscall CPLODBCSession::CommitTransaction(void)" (?CommitTransaction#CPLODBCSession##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLError#32 referenced in function "public: int __thiscall CPLODBCSession::Failed(int,void *)" (?Failed#CPLODBCSession##QAEHHPAX#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLExecDirect#12 referenced in function "public: int __thiscall CPLODBCStatement::ExecuteSQL(char const *)" (?ExecuteSQL#CPLODBCStatement##QAEHPBD#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFetch#4 referenced in function "public: int __thiscall CPLODBCStatement::Fetch(int,int)" (?Fetch#CPLODBCStatement##QAEHHH#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFetchScroll#12 referenced in function "public: int __thiscall CPLODBCStatement::Fetch(int,int)" (?Fetch#CPLODBCStatement##QAEHHH#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFreeConnect#4 referenced in function "public: int __thiscall CPLODBCSession::CloseSession(void)" (?CloseSession#CPLODBCSession##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFreeEnv#4 referenced in function "public: int __thiscall CPLODBCSession::CloseSession(void)" (?CloseSession#CPLODBCSession##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLFreeStmt#8 referenced in function "public: __thiscall CPLODBCStatement::~CPLODBCStatement(void)" (??1CPLODBCStatement##QAE#XZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLGetConnectAttr#20 referenced in function "public: int __thiscall CPLODBCSession::ClearTransaction(void)" (?ClearTransaction#CPLODBCSession##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLGetData#24 referenced in function "public: int __thiscall CPLODBCStatement::Fetch(int,int)" (?Fetch#CPLODBCStatement##QAEHHH#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLNumResultCols#8 referenced in function "public: int __thiscall CPLODBCStatement::CollectResultsInfo(void)" (?CollectResultsInfo#CPLODBCStatement##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLSetConnectAttr#16 referenced in function "public: int __thiscall CPLODBCSession::ClearTransaction(void)" (?ClearTransaction#CPLODBCSession##QAEHXZ)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLSetConnectOption#12 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession#CPLODBCSession##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLTables#36 referenced in function "public: int __thiscall CPLODBCStatement::GetTables(char const *,char const *)" (?GetTables#CPLODBCStatement##QAEHPBD0#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLDriverConnect#32 referenced in function "public: int __thiscall CPLODBCSession::EstablishSession(char const *,char const *,char const *)" (?EstablishSession#CPLODBCSession##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLPrimaryKeys#28 referenced in function "public: int __thiscall CPLODBCStatement::GetPrimaryKeys(char const *,char const *,char const *)" (?GetPrimaryKeys#CPLODBCStatement##QAEHPBD00#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLRemoveDriver#12 referenced in function "public: int __thiscall CPLODBCDriverInstaller::RemoveDriver(char const *,int)" (?RemoveDriver#CPLODBCDriverInstaller##QAEHPBDH#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLInstallerError#20 referenced in function "public: int __thiscall CPLODBCDriverInstaller::InstallDriver(char const *,char const *,unsigned short)" (?InstallDriver#CPLODBCDriverInstaller##QAEHPBD0G#Z)
2>gdal.lib(cpl_odbc.obj) : error LNK2019: unresolved external symbol _SQLInstallDriverEx#28 referenced in function "public: int __thiscall CPLODBCDriverInstaller::InstallDriver(char const *,char const *,unsigned short)" (?InstallDriver#CPLODBCDriverInstaller##QAEHPBD0G#Z)
The only think I was able to find is that all the missing method seems to be deprecated ODBC method, like this one
For additional information, the project got a reference to odbc32.lib in its inherited values.
Okay, stupid question... the odbc's dependencies were in the inherited values... but the checkbox indicated to the build process to use these dependencies was not checked. Once it was done, everything is good... I think I need either a coffee or a very big smack on the head...
I'm having some problems with using CEF in my application which uses the MD/MDd runtime library linking.
I have downloaded the latest build of CEF3 from cefbuilds.com and followed the instructions How to link CEF against a different run-time library.
I have built the "libcef_dll_wrapper" project after changing "Runtime Library" to "/MDd" and "Platform Toolset" to "v110" and then I've linked the resulting "libcef_dll_wrapper.lib" binary to my project.
However, when I try to build my project I get the following errors:
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_utf16_clear referenced in function "public: static void __cdecl CefBrowserSettingsTraits::clear(struct _cef_browser_settings_t *)" (?clear#CefBrowserSettingsTraits##SAXPAU_cef_browser_settings_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_utf8_to_utf16 referenced in function "public: static bool __cdecl CefStringTraitsUTF16::from_string(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct _cef_string_utf16_t *)" (?from_string#CefStringTraitsUTF16##SA_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PAU_cef_string_utf16_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_list_free referenced in function "public: static void __cdecl CefSettingsTraits::clear(struct _cef_settings_t *)" (?clear#CefSettingsTraits##SAXPAU_cef_settings_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl CefBrowser::CreateBrowser(class CefWindowInfo &,class CefRefPtr<class CefClient>,class CefStringBase<struct CefStringTraitsUTF16> const &,class CefStructBase<struct CefBrowserSettingsTraits> const &)" (?CreateBrowser#CefBrowser##SA_NAAVCefWindowInfo##V?$CefRefPtr#VCefClient####ABV?$CefStringBase#UCefStringTraitsUTF16####ABV?$CefStructBase#UCefBrowserSettingsTraits#####Z) referenced in function "public: void __thiscall caspar::html::html_producer::run(void)" (?run#html_producer#html#caspar##QAEXXZ)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol "bool __cdecl CefInitialize(class CefStructBase<struct CefSettingsTraits> const &,class CefRefPtr<class CefApp>)" (?CefInitialize##YA_NABV?$CefStructBase#UCefSettingsTraits####V?$CefRefPtr#VCefApp#####Z) referenced in function "public: void __thiscall caspar::html::html_producer::run(void)" (?run#html_producer#html#caspar##QAEXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_execute_process referenced in function "int __cdecl CefExecuteProcess(class CefMainArgs const &,class CefRefPtr<class CefApp>)" (?CefExecuteProcess##YAHABVCefMainArgs##V?$CefRefPtr#VCefApp#####Z)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_initialize referenced in function "bool __cdecl CefInitialize(class CefMainArgs const &,class CefStructBase<struct CefSettingsTraits> const &,class CefRefPtr<class CefApp>)" (?CefInitialize##YA_NABVCefMainArgs##ABV?$CefStructBase#UCefSettingsTraits####V?$CefRefPtr#VCefApp#####Z)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_shutdown referenced in function "void __cdecl CefShutdown(void)" (?CefShutdown##YAXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_do_message_loop_work referenced in function "void __cdecl CefDoMessageLoopWork(void)" (?CefDoMessageLoopWork##YAXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_run_message_loop referenced in function "void __cdecl CefRunMessageLoop(void)" (?CefRunMessageLoop##YAXXZ)
The full log can be found here.
Any ideas as to what I might be missing?
Are you also libcef.lib in the linker input?
I am trying to add a sound library to a GLFW / OpenGL project in windows. I have set the sound project to output a static library (.lib). It compiles fine.
In my main project, I add a reference to Sound and a dependency on Sound (to change the build order). I include "..\Sound\sound.h" in my main.cpp and Intellisense is happy with everything. All compiles well. However, the linker is pissed:
1>Link:
1> LINK : ###\Projects\DeathRace\Debug\DeathRace.exe not found or not built by the last incremental link; performing full link
1>Sound.lib(sound.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in base_objects.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alListenerfv referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alListener3f referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alGetError referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutGetError referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutInit referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutExit referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alDeleteBuffers referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alDeleteSources referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutCreateBufferFromFile referenced in function "public: unsigned int * __thiscall SoundAPI::LoadSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?LoadSound#SoundAPI##QAEPAIV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSource3f referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcef referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourceQueueBuffers referenced in function "public: bool __thiscall SoundAPI::Queue(unsigned int *,unsigned int *)" (?Queue#SoundAPI##QAE_NPAI0#Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function "public: bool __thiscall SoundAPI::Play(unsigned int *)" (?Play#SoundAPI##QAE_NPAI#Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcePause referenced in function "public: bool __thiscall SoundAPI::Pause(unsigned int *)" (?Pause#SoundAPI##QAE_NPAI#Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourceStop referenced in function "public: bool __thiscall SoundAPI::Stop(unsigned int *)" (?Stop#SoundAPI##QAE_NPAI#Z)
1>###\Projects\DeathRace\Debug\DeathRace.exe : fatal error LNK1120: 17 unresolved externals
I have NO IDEA what to make of this. Lnk2038 is supposed to mean a problem between debug and release, but everything is in debug mode. The lnk2019 should be fine against Sound.lib?
Much obliged!
Everything fine with your library (except you mixing debug and release runtime). You'll have to link a debug build when building a program in debug mode. Same is true for release builds. That's for error LNK2038 and warning LNK4098.
The other errors are caused by the simple fact that you can't link a static library with a static library (here: OpenAL), because that would get extra complicated if two static libraries would refer to the same static code (essentially leading to multiple definitions).
What you have to do for these errors to be solved is simple: Link your resulting executable file to your own Sound.lib as well as the right OpenAL library file and everything should be fine.