Following this instruction, I am migrating a legacy VC++ project to MSVS2017 . I'm getting the following error currently:
eafxisd.lib(isapi.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &,int)" (__imp_??0exception#std##QAE#ABQBDH#Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(void)" (??0bad_alloc#std##QAE#XZ)
This is the only error left. Any ideas how to resolve it?
Update:
There are also some warnings, if this is relevant:
1>eafxisd.lib(isapi.obj) : warning LNK4217: locally defined symbol ??1exception#std##UAE#XZ (public: virtual __thiscall std::exception::~exception(void)) imported in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" (??1bad_alloc#std##UAE#XZ)
1>eafxisd.lib(isapi.obj) : warning LNK4217: locally defined symbol ??0exception#std##QAE#ABV01##Z (public: __thiscall std::exception::exception(class std::exception const &)) imported in function "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)" (??0bad_alloc#std##QAE#ABV01##Z)
I am linking the following standard libraries:
eafxisd.lib
nafxisd.lib
legacy_stdio_definitions.lib
I ignore legacy MFC libraries:
mfc80d.lib
mfcs80d.lib
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 am trying to compile, in Visual Studio 2015, a DLL that I am making which acts as a C-compatible wrapper around some functionality from OpenVDB, making it usable in an existing C project. When I build, however, I get the following Linker Errors:
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class std::basic_streambuf<char,struct std::char_traits<char> > > __thiscall openvdb::v4_0_1::io::MappedFile::createBuffer(void)const " (__imp_?createBuffer#MappedFile#io#v4_0_1#openvdb##QBE?AV?$shared_ptr#V?$basic_streambuf#DU?$char_traits#D#std###std###std##XZ) referenced in function "private: void __thiscall openvdb::v4_0_1::tree::LeafBuffer<float,3>::doLoad(void)const " (?doLoad#?$LeafBuffer#M$02#tree#v4_0_1#openvdb##ABEXXZ)
Error LNK2019 unresolved external symbol "__declspec(dllimport) class std::shared_ptr<class openvdb::v4_0_1::io::StreamMetadata> __cdecl openvdb::v4_0_1::io::getStreamMetadataPtr(class std::ios_base &)" (__imp_?getStreamMetadataPtr#io#v4_0_1#openvdb##YA?AV?$shared_ptr#VStreamMetadata#io#v4_0_1#openvdb###std##AAVios_base#5##Z) referenced in function "void __cdecl openvdb::v4_0_1::io::readCompressedValues<float,class openvdb::v4_0_1::util::NodeMask<3> >(class std::basic_istream<char,struct std::char_traits<char> > &,float *,unsigned int,class openvdb::v4_0_1::util::NodeMask<3> const &,bool)" (??$readCompressedValues#MV?$NodeMask#$02#util#v4_0_1#openvdb###io#v4_0_1#openvdb##YAXAAV?$basic_istream#DU?$char_traits#D#std###std##PAMIABV?$NodeMask#$02#util#12#_N#Z)
Error LNK2019 unresolved external symbol "__declspec(dllimport) void __cdecl openvdb::v4_0_1::io::setStreamMetadataPtr(class std::ios_base &,class std::shared_ptr<class openvdb::v4_0_1::io::StreamMetadata> &,bool)" (__imp_?setStreamMetadataPtr#io#v4_0_1#openvdb##YAXAAVios_base#std##AAV?$shared_ptr#VStreamMetadata#io#v4_0_1#openvdb###5#_N#Z) referenced in function "private: void __thiscall openvdb::v4_0_1::tree::LeafBuffer<float,3>::doLoad(void)const " (?doLoad#?$LeafBuffer#M$02#tree#v4_0_1#openvdb##ABEXXZ)
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: static class std::shared_ptr<class openvdb::v4_0_1::math::Transform> __cdecl openvdb::v4_0_1::math::Transform::createLinearTransform(class openvdb::v4_0_1::math::Mat4<double> const &)" (__imp_?createLinearTransform#Transform#math#v4_0_1#openvdb##SA?AV?$shared_ptr#VTransform#math#v4_0_1#openvdb###std##ABV?$Mat4#N#234##Z) referenced in function "public: static class std::shared_ptr<class openvdb::v4_0_1::math::Transform> __cdecl OpenVDB_c::LinearTransform(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)" (?LinearTransform#OpenVDB_c##SA?AV?$shared_ptr#VTransform#math#v4_0_1#openvdb###std##NNNNNNNNNNNNNNNN#Z)
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: void __thiscall openvdb::v4_0_1::GridBase::setTransform(class std::shared_ptr<class openvdb::v4_0_1::math::Transform>)" (__imp_?setTransform#GridBase#v4_0_1#openvdb##QAEXV?$shared_ptr#VTransform#math#v4_0_1#openvdb###std###Z) referenced in function __catch$?setGridTransform#OpenVDB_c##QAE_NHV?$shared_ptr#VTransform#math#v4_0_1#openvdb###std###Z$0
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class openvdb::v4_0_1::GridBase> __thiscall openvdb::v4_0_1::io::File::readGrid(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?readGrid#File#io#v4_0_1#openvdb##QAE?AV?$shared_ptr#VGridBase#v4_0_1#openvdb###std##ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##6##Z) referenced in function "public: int __thiscall OpenVDB_c::readGrid(int,char *)" (?readGrid#OpenVDB_c##QAEHHPAD#Z)
Error LNK2001 unresolved external symbol "public: virtual class std::shared_ptr<class openvdb::v4_0_1::io::Archive> __thiscall openvdb::v4_0_1::io::File::copy(void)const " (?copy#File#io#v4_0_1#openvdb##UBE?AV?$shared_ptr#VArchive#io#v4_0_1#openvdb###std##XZ)
Error LNK2001 unresolved external symbol "public: virtual void __thiscall openvdb::v4_0_1::io::File::write(class std::vector<class std::shared_ptr<class openvdb::v4_0_1::GridBase const >,class std::allocator<class std::shared_ptr<class openvdb::v4_0_1::GridBase const > > > const &,class openvdb::v4_0_1::MetaMap const &)const " (?write#File#io#v4_0_1#openvdb##UBEXABV?$vector#V?$shared_ptr#$$CBVGridBase#v4_0_1#openvdb###std##V?$allocator#V?$shared_ptr#$$CBVGridBase#v4_0_1#openvdb###std###2##std##ABVMetaMap#34##Z)
Error LNK2001 unresolved external symbol "__declspec(dllimport) private: static union half::uif const * const half::_toFloat" (__imp_?_toFloat#half##0QBTuif#1#B) C:\Users\t00001657\documents\visual studio 2015\Projects\OVDBC\OVDBC\ovdbc.obj 1
OpenVDB and all of its dependencies are in the include folder, whose directory is added to additional include directories, and this is my current list of Additional Dependencies under the Linker options:
blosc.lib
cppunit.lib
glew32.lib
glfw3.lib
Half.lib
Iex-2_2.lib
IexMath-2_2.lib
IlmImf-2_2.lib
IlmImfUtil-2_2.lib
IlmThread-2_2.lib
Imath2_2.lib
openvdb.lib
tbb.lib
tbb_debug.lib
tbb_preview.lib
tbb_preview_debug.lib
tbbmalloc.lib
tbbmalloc_debug.lib
tbbproxy.lib
zlibstaticd.lib
I can't seem to find any information on compiling with OpenVDB in Visual Studio that covers this kind of error, and am pretty stumped as to what I could be forgetting.
It turned out to be a combination of a couple problems:
My OpenVDB binaries were compiled with OPENVDB_3_ABI_COMPATIBLE defined, and so were using the boost version of shared_ptr instead of the std version, but I hadn't defined OPENVDB_3_ABI_COMPATIBLE when trying to build my project, so it was trying to build using the std version; hence, undefined externals.
I hadn't defined OPENEXR_DLL and HALF_EXPORTS, which is evidently required when building with those libraries, unbeknownst to me.
I was compiling with the /MT option instead of the /MDd option used by half.lib
In the end, all I needed to do was define OPENEXR_DLL, HALF_EXPORTS, and OPENVDB_3_ABI_COMPATIBLE, and switch the build option to /MDd.
Try to use Vcpkg.
It supports visual studio 2015,2017
https://github.com/Microsoft/vcpkg
It's easy to use like yum in Linux.
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 wish I could ask "What libraries do i need to link" but it's quite specific (wwise engine integration), so I need help in working it out myself. The problem occurs when I attempt to create a variable of a type defined in a header file (compiler finds the header no problem). I get 22 linker errors but I don't understand the read out, could someone walk me through it and tell me precisely which symbol is missing so I can figure out what libraries I'm missing? and could it be anything other than a library not linking? Wwise comes with a demo project that compiles but doesnt link to any more libraries than I do.
Here are 5 of the errors. I'm using visual studio.
1>main.obj : error LNK2019: unresolved external symbol "public: enum AKRESULT __thiscall CAkDefaultIOHookBlocking::Init(struct AkDeviceSettings const &,bool)" (?Init#CAkDefaultIOHookBlocking##QAE?AW4AKRESULT##ABUAkDeviceSettings##_N#Z) referenced in function "bool __cdecl InitSoundEngine(void)" (?InitSoundEngine##YA_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CAkDefaultIOHookBlocking::GetDeviceDesc(struct AkDeviceDesc &)" (?GetDeviceDesc#CAkDefaultIOHookBlocking##UAEXAAUAkDeviceDesc###Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CAkDefaultIOHookBlocking::GetDeviceData(void)" (?GetDeviceData#CAkDefaultIOHookBlocking##UAEKXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual enum AKRESULT __thiscall CAkDefaultIOHookBlocking::Read(struct AkFileDesc &,struct AkIoHeuristics const &,void *,struct AkIOTransferInfo &)" (?Read#CAkDefaultIOHookBlocking##UAE?AW4AKRESULT##AAUAkFileDesc##ABUAkIoHeuristics##PAXAAUAkIOTransferInfo###Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual enum AKRESULT __thiscall CAkDefaultIOHookBlocking::Write(struct AkFileDesc &,struct AkIoHeuristics const &,void *,struct AkIOTransferInfo &)" (?Write#CAkDefaultIOHookBlocking##UAE?AW4AKRESULT##AAUAkFileDesc##ABUAkIoHeuristics##PAXAAUAkIOTransferInfo###Z)
The symbols are:
enum AKRESULT CAkDefaultIOHookBlocking::Init(struct AkDeviceSettings const &,bool)
virtual void CAkDefaultIOHookBlocking::GetDeviceDesc(struct AkDeviceDesc &)
virtual unsigned long CAkDefaultIOHookBlocking::GetDeviceData(void)
virtual enum AKRESULT CAkDefaultIOHookBlocking::Read(struct AkFileDesc &,struct AkIoHeuristics const &,void *,struct AkIOTransferInfo &)
virtual enum AKRESULT CAkDefaultIOHookBlocking::Write(struct AkFileDesc &,struct AkIoHeuristics const &,void *,struct AkIOTransferInfo &)
As far as I can tell, you only have the header that declares the class CAkDefaultIOHookBlocking, which means that you attempt to use any of the above symbols you'll need to link against the library.
Wwise comes with a demo project that compiles but doesnt link to any more libraries than I do.
Either the symbols aren't used, or the source files that defines those symbols is compiled in that project - http://gmwwise.googlecode.com/svn-history/r2/trunk/GMWwise/wwise/AkDefaultIOHookBlocking.cpp
You have a file AkDefaultIOHookBlocking.cpp that hasn't been added to the project you're building.
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.