I'm using an external library that I do not have control over, more precisely ADTF streaming library. I linked to this library in Visual Studio 2019 (using VS 2010 Platform Toolset). To do so, I added the include directory to
ProjectName -> Properties -> C/C++ -> General,
the path to the folder containing the lib to
ProjectName -> Properties -> Linker -> General
and the name of the lib (adtfstreamingD_280.lib) to
ProjectName -> Properties -> Linker -> Input.
No I get a linker error but only for static class methods, there is no linker error for non-static methods. Does anyone know how to resolve such a problem? Any help would be very appreciated.
My Code:
header file:
#ifndef _DAT_HANDLER_H_
#define _DAT_HANDLER_H_
#include <string>
#include <stdint.h>
#include "adtf_streaming.h"
class DatHandler
{
public:
DatHandler();
~DatHandler();
void Load(std::string datFilePath);
int32_t GetNumOfStreams();
protected:
private:
// Resources are handled by ADTF
adtfstreaming::IADTFFileReader* m_fileReader;
};
#endif // _DAT_HANDLER_H_
cpp file:
#include "DatHandler.h"
DatHandler::DatHandler() : m_fileReader(nullptr)
{
// do nothing
}
DatHandler::~DatHandler()
{
if (nullptr != m_fileReader)
{
m_fileReader->Close();
adtfstreaming::IADTFFileReader::Release(m_fileReader);
}
}
int32_t DatHandler::GetNumOfStreams()
{
int32_t streamCount;
tResult res = m_fileReader->GetStreamCount(streamCount);
if (IS_FAILED(res))
{
return -1;
}
return streamCount;
}
void DatHandler::Load(std::string path)
{
if (nullptr == m_fileReader)
{
m_fileReader = adtfstreaming::IADTFFileReader::Create();
}
else
{
m_fileReader->Close();
}
m_fileReader->Open(path.c_str());
}
The errors (in German, don't know how to get Error output in English):
Error LNK2019 Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: static long __cdecl adtfstreaming::IADTFFileReader::Release(class adtfstreaming::IADTFFileReader *)" (__imp_?Release@IADTFFileReader@adtfstreaming@@SAJPAV12@@Z)" in Funktion ""public: __thiscall DatHandler::~DatHandler(void)" (??1DatHandler@@QAE@XZ)".
Error LNK2019 Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: static class adtfstreaming::IADTFFileReader * __cdecl adtfstreaming::IADTFFileReader::Create(void)" (__imp_?Create@IADTFFileReader@adtfstreaming@@SAPAV12@XZ)" in Funktion ""public: void __thiscall DatHandler::Load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?Load@DatHandler@@QAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)".
Error LNK1120 2 nicht aufgelöste externe Verweise.
Edit: Maybe I also should have mentioned that I only have ADTF streaming library 2.8.0 available.