0

I want add to source XBMC (this is Kodi multimedia center) My own class function, but I have LNK2019 error. I never programmed in C++. I read many threads about this error, but I don't understand what I'm doing wrong.

At start I want to add CProjectorSettings::LoadSources(); function class to WinSystemWin32.cpp file.

xbmc/settings/ProjectorSettings.cpp

#include "ProjectorSettings.h"

#include "utils/log.h"

#define SYSTEM_XML_FOLDER "special://xbmc/system/"

void CProjectorSettings::LoadSources()
{
  CLog::Log(LOGINFO, "Function working !!!!!!s");
}

xbmc/settings/ProjectorSettings.h

#ifndef PROJECTORSETTINGS_H
#define PROJECTORSETTINGS_H

class CProjectorSettings
{
  public:
    void LoadSources();
};

#endif

xbmc/windowing/windows/WinSystemWin32.cpp (L34 - L38)

#include "platform/win32/CharsetConverter.h"
#include "platform/win32/input/IRServerSuite.h"

#include "settings/ProjectorSettings.h"

#include <algorithm>
#include <mutex>

(L126 - L137)

if (hUser32)
  {
    PtrGetGestureInfo = reinterpret_cast<pGetGestureInfo>(GetProcAddress(hUser32, "GetGestureInfo"));
    PtrSetGestureConfig = reinterpret_cast<pSetGestureConfig>(GetProcAddress(hUser32, "SetGestureConfig"));
    PtrCloseGestureInfoHandle = reinterpret_cast<pCloseGestureInfoHandle>(GetProcAddress(hUser32, "CloseGestureInfoHandle"));
    // if available, enable automatic DPI scaling of the non-client area portions of the window.
    PtrEnableNonClientDpiScaling = reinterpret_cast<pEnableNonClientDpiScaling>(GetProcAddress(hUser32, "EnableNonClientDpiScaling"));
  }

  CProjectorSettings::LoadSources(); //<--- My function

  UpdateStates(fullScreen);
  // initialize the state
  WINDOW_STATE state = GetState(fullScreen);

WinSystemWin32.cpp#L134

Error result compile:

python_binding.vcxproj -> C:\Users\Dell\kodi\kodi-build.x64\build\swig\Release\python_binding.lib
  upnp.vcxproj -> C:\Users\Dell\kodi\kodi-build.x64\build\upnp\Release\upnp.lib
WinSystemWin32.cpp
C:\Users\Dell\kodi\xbmc\windowing\windows\WinSystemWin32.cpp(141,23): error C2352: 'CProjectorSettings::LoadSources': illegal call of non-static member functio
n [C:\Users\Dell\kodi\kodi-build.x64\libkodi.vcxproj]
C:\Users\Dell\kodi\xbmc\settings/ProjectorSettings.h(7): message : see declaration of 'CProjectorSettings::LoadSources' [C:\Users\Dell\kodi\kodi-build.x64\libk
odi.vcxproj]

When I try add static to ProjectorSettings.h

class CProjectorSettings
{
  public:
    static void LoadSources(); //<- here added "static"
};

I have compile error:

upnp.vcxproj -> C:\Users\Dell\kodi\kodi-build.x64\build\upnp\Release\upnp.lib
  libkodi.vcxproj -> C:\Users\Dell\kodi\kodi-build.x64\Release\libkodi.lib
     Creating library C:/Users/Dell/kodi/kodi-build.x64/Release/kodi.lib and object C:/Users/Dell/kodi/kodi-build.x64/Release/kodi.exp
libkodi.lib(WinSystemWin32.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl CProjectorSettings::LoadSources(void)" (?LoadSources@C
ProjectorSettings@@SAXXZ) referenced in function "protected: virtual bool __cdecl CWinSystemWin32::CreateNewWindow(class std::basic_string<char,struct std::cha
r_traits<char>,class std::allocator<char> > const &,bool,struct RESOLUTION_INFO &)" (?CreateNewWindow@CWinSystemWin32@@MEAA_NAEBV?$basic_string@DU?$char_traits 
@D@std@@V?$allocator@D@2@@std@@_NAEAURESOLUTION_INFO@@@Z) [C:\Users\Dell\kodi\kodi-build.x64\kodi.vcxproj]
C:\Users\Dell\kodi\kodi-build.x64\Release\kodi.exe : fatal error LNK1120: 1 unresolved externals [C:\Users\Dell\kodi\kodi-build.x64\kodi.vcxproj]
273K
  • 19,191
  • 8
  • 34
  • 47
Peter
  • 468
  • 9
  • 26

0 Answers0