It can depend on the Windows SDK version
With 10.0.20348.0, I don't need any additional linked lib with WinRT
With older versions, I need to link with "WindowsApp.lib"
In some old threads, "OleAut32.lib" was needed too
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
cl.exe /std:c++17 /Zi /EHsc /nologo /Fe: "C:\behe\My_life\programmation\rainmeter c++ app simple ii guess\main.exe" "C:\behe\My_life\programmation\rainmeter c++ app simple ii guess\main.cpp"
main.cpp
main.obj : error LNK2019: unresolved external symbol _WINRT_IMPL_SetErrorInfo@8 referenced in function "struct winrt::hresult __cdecl winrt::impl::get_runtime_activation_factory<struct winrt::Windows::Foundation::IActivationFactory>(struct winrt::param::hstring const &,void * *)" (??$get_runtime_activation_factory@UIActivationFactory@Foundation@Windows @winrt@@@impl@winrt@@YA?AUhresult@1@ABUhstring@Paramjeet Dahiya @1@PAPAX@Z)
main.obj : error LNK2019: unresolved external symbol _WINRT_IMPL_GetErrorInfo@8 referenced in function "struct winrt::hresult __cdecl winrt::impl::get_runtime_activation_factory<struct winrt::Windows::Foundation::IActivationFactory>(struct winrt::param::hstring const &,void * *)" (??$get_runtime_activation_factory@UIActivationFactory@Foundation@Windows @winrt@@@impl@winrt@@YA?AUhresult@1@ABUhstring@Paramjeet Dahiya @1@PAPAX@Z)
main.obj : error LNK2019: unresolved external symbol _WINRT_IMPL_SysAllocString@4 referenced in function "public: virtual int __stdcall winrt::impl::error_info_fallback::GetDescription(wchar_t * *)" (?GetDescription@error_info_fallback@impl@winrt@@UAGHPAPA_W@Z)
main.obj : error LNK2019: unresolved external symbol _WINRT_IMPL_SysFreeString@4 referenced in function "public: static void __cdecl winrt::impl::bstr_traits::close(wchar_t *)" (?close@bstr_traits@impl@winrt@@SAXPA_W@Z)
main.obj : error LNK2019: unresolved external symbol _WINRT_IMPL_SysStringLen@4 referenced in function "public: __thiscall winrt::hresult_error::hresult_error(struct winrt::hresult,struct winrt::take_ownership_from_abi_t)" (??0hresult_error@winrt@@QAE@Uhresult@1@Utake_ownership_from_abi_t@1@@Z)
C:\behe\My_life\programmation\rainmeter c++ app simple ii guess\main.exe : fatal error LNK1120: 5 unresolved externals
this is the compiler error I get and this is main.cpp
include <fstream>
include <iostream>
include <filesystem>
include <chrono>
include <thread>
include <winrt/base.h>
include <winrt/windows.ui.viewmanagement.h>
int main (){
bool running = true;
winrt::Windows::UI::ViewManagement::UISettings Colsettings;
auto coloracc = Colsettings.GetColorValue(winrt::Windows::UI::ViewManagement::UIColorType::Accent);
std::cout << coloracc.B;
if (!std::filesystem::exists("color.inc")) {
running = false;
}
while (running)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
std::cout << "aaaaaaaaaaa";
}
}
so yeah thanks for help I guess I can use any ide right
It can depend on the Windows SDK version
With 10.0.20348.0, I don't need any additional linked lib with WinRT
With older versions, I need to link with "WindowsApp.lib"
In some old threads, "OleAut32.lib" was needed too