在Visual Studio上使用FTXUI配置项目

6rvt4ljy  于 2023-03-13  发布在  其他
关注(0)|答案(1)|浏览(306)

首先,我使用VCPKG

vcpkg.exe install ftxui

然后,我在Visual Studio Community 2022上创建了一个新项目,尝试执行FXUI文档中的button example(刚刚复制并粘贴)。
因此,我修改了VS 2022中的项目属性,添加了VCPKG放置FXTUI头文件和库的目录:
Include DirectoriesLibrary Directories
但是,当我尝试构建项目时,出现以下错误:
Errors

Severity    Code    Description Project File    Line    Suppression State
Error   LNK1120 14 unresolved externals test_tui    C:\Users\lyang.medeiros\workspace\test_tui\x64\Debug\test_tui.exe   1   
Error   LNK2019 unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl ftxui::to_string(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?to_string@ftxui@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@3@@Z) referenced in function "public: __cdecl ftxui::ConstStringRef::ConstStringRef(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >)" (??0ConstStringRef@ftxui@@QEAA@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)  test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl ftxui::to_wstring(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?to_wstring@ftxui@@YA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) referenced in function "public: __cdecl ftxui::ConstStringRef::ConstStringRef(char const *)" (??0ConstStringRef@ftxui@@QEAA@PEBD@Z) test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::Node> __cdecl ftxui::operator|(class std::shared_ptr<class ftxui::Node>,class std::function<class std::shared_ptr<class ftxui::Node> __cdecl(class std::shared_ptr<class ftxui::Node>)>)" (??Uftxui@@YA?AV?$shared_ptr@VNode@ftxui@@@std@@V12@V?$function@$$A6A?AV?$shared_ptr@VNode@ftxui@@@std@@V12@@Z@2@@Z) referenced in function "public: __cdecl `int __cdecl main(int,char const * * const)'::`2'::<lambda_3>::operator()(void)const " (??R<lambda_3>@?1??main@@YAHHQEAPEBD@Z@QEBA@XZ)    test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::Node> __cdecl ftxui::text(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?text@ftxui@@YA?AV?$shared_ptr@VNode@ftxui@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) referenced in function "public: __cdecl `int __cdecl main(int,char const * * const)'::`2'::<lambda_3>::operator()(void)const " (??R<lambda_3>@?1??main@@YAHHQEAPEBD@Z@QEBA@XZ) test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::Node> __cdecl ftxui::separator(void)" (?separator@ftxui@@YA?AV?$shared_ptr@VNode@ftxui@@@std@@XZ) referenced in function "public: __cdecl `int __cdecl main(int,char const * * const)'::`2'::<lambda_3>::operator()(void)const " (??R<lambda_3>@?1??main@@YAHHQEAPEBD@Z@QEBA@XZ) test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::Node> __cdecl ftxui::gauge(float)" (?gauge@ftxui@@YA?AV?$shared_ptr@VNode@ftxui@@@std@@M@Z) referenced in function "public: __cdecl `int __cdecl main(int,char const * * const)'::`2'::<lambda_3>::operator()(void)const " (??R<lambda_3>@?1??main@@YAHHQEAPEBD@Z@QEBA@XZ)   test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::Node> __cdecl ftxui::border(class std::shared_ptr<class ftxui::Node>)" (?border@ftxui@@YA?AV?$shared_ptr@VNode@ftxui@@@std@@V23@@Z) referenced in function "public: __cdecl `int __cdecl main(int,char const * * const)'::`2'::<lambda_3>::operator()(void)const " (??R<lambda_3>@?1??main@@YAHHQEAPEBD@Z@QEBA@XZ)   test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::Node> __cdecl ftxui::vbox(class std::vector<class std::shared_ptr<class ftxui::Node>,class std::allocator<class std::shared_ptr<class ftxui::Node> > >)" (?vbox@ftxui@@YA?AV?$shared_ptr@VNode@ftxui@@@std@@V?$vector@V?$shared_ptr@VNode@ftxui@@@std@@V?$allocator@V?$shared_ptr@VNode@ftxui@@@std@@@2@@3@@Z) referenced in function "public: __cdecl `int __cdecl main(int,char const * * const)'::`2'::<lambda_3>::operator()(void)const " (??R<lambda_3>@?1??main@@YAHHQEAPEBD@Z@QEBA@XZ)    test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "public: static struct ftxui::ButtonOption __cdecl ftxui::ButtonOption::Simple(void)" (?Simple@ButtonOption@ftxui@@SA?AU12@XZ) referenced in function main   test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::ComponentBase> __cdecl ftxui::Container::Horizontal(class std::vector<class std::shared_ptr<class ftxui::ComponentBase>,class std::allocator<class std::shared_ptr<class ftxui::ComponentBase> > >)" (?Horizontal@Container@ftxui@@YA?AV?$shared_ptr@VComponentBase@ftxui@@@std@@V?$vector@V?$shared_ptr@VComponentBase@ftxui@@@std@@V?$allocator@V?$shared_ptr@VComponentBase@ftxui@@@std@@@2@@4@@Z) referenced in function main    test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::ComponentBase> __cdecl ftxui::Button(class ftxui::ConstStringRef,class std::function<void __cdecl(void)>,class ftxui::Ref<struct ftxui::ButtonOption>)" (?Button@ftxui@@YA?AV?$shared_ptr@VComponentBase@ftxui@@@std@@VConstStringRef@1@V?$function@$$A6AXXZ@3@V?$Ref@UButtonOption@ftxui@@@1@@Z) referenced in function main    test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "class std::shared_ptr<class ftxui::ComponentBase> __cdecl ftxui::Renderer(class std::shared_ptr<class ftxui::ComponentBase>,class std::function<class std::shared_ptr<class ftxui::Node> __cdecl(void)>)" (?Renderer@ftxui@@YA?AV?$shared_ptr@VComponentBase@ftxui@@@std@@V23@V?$function@$$A6A?AV?$shared_ptr@VNode@ftxui@@@std@@XZ@3@@Z) referenced in function main  test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "public: static class ftxui::ScreenInteractive __cdecl ftxui::ScreenInteractive::FitComponent(void)" (?FitComponent@ScreenInteractive@ftxui@@SA?AV12@XZ) referenced in function main test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Error   LNK2019 unresolved external symbol "public: void __cdecl ftxui::ScreenInteractive::Loop(class std::shared_ptr<class ftxui::ComponentBase>)" (?Loop@ScreenInteractive@ftxui@@QEAAXV?$shared_ptr@VComponentBase@ftxui@@@std@@@Z) referenced in function main  test_tui    C:\Users\lyang.medeiros\workspace\test_tui\test_tui\test_tui.obj    1   
Warning LNK4272 library machine type 'x86' conflicts with target machine type 'x64' test_tui    C:\Users\lyang.medeiros\workspace\vcpkg\packages\ftxui_x86-windows\debug\lib\ftxui-component.lib    1   
Warning LNK4272 library machine type 'x86' conflicts with target machine type 'x64' test_tui    C:\Users\lyang.medeiros\workspace\vcpkg\packages\ftxui_x86-windows\debug\lib\ftxui-dom.lib  1   
Warning LNK4272 library machine type 'x86' conflicts with target machine type 'x64' test_tui    C:\Users\lyang.medeiros\workspace\vcpkg\packages\ftxui_x86-windows\debug\lib\ftxui-screen.lib   1

如何正确设置此项目?
如何在Visual Studio 2022上使用FTXUI配置项目?

yqlxgs2m

yqlxgs2m1#

正如库文件夹名称所述,您应该在库目录中使用x86(Win32)和debug\lib。

相关问题