Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up on Windows + Unreal Engine #195

Open
vladinator1000 opened this issue Sep 1, 2023 · 4 comments
Open

How to set up on Windows + Unreal Engine #195

vladinator1000 opened this issue Sep 1, 2023 · 4 comments

Comments

@vladinator1000
Copy link

Hi folks, I'm a C++ noob, I was impressed by the library because I'm familiar with the pattern from web development. I also love making games in Unreal Engine and was hoping to use Lager, but I'm having trouble including the library.

  1. Created an unreal module following these instructions: https://youtu.be/wJquw_-X4YQ
  2. Cloned Lager within my project
  3. Included something from Lager
devenv_2ChEUX55JD
  1. It wouldn't build because of a missing dependency
devenv_hO6QpsErqh
  1. Went to the readme to look for install instructions, looks like they were for linux so I had to improvise
firefox_pJyvrN8Xuu
  1. Navigated to the cloned Lager root directory and ran
cmake .
  1. Then got this error
-- Could not find ccache
-- Disabling compile-time checks for store dependencies
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR system) (Required is at
  least version "1.56")
Call Stack (most recent call first):
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.26/Modules/FindBoost.cmake:2377 (find_package_handle_standard_args)
  CMakeLists.txt:72 (find_package)
-- Configuring incomplete, errors occurred!

Do you have any tips on how I can make this work?

@vladinator1000 vladinator1000 changed the title Usage on Windows + Unreal Engine How to set up on Windows + Unreal Engine Sep 1, 2023
@arximboldi
Copy link
Owner

You need to also install Boost, Zug, and potentially Immer in practice. The best way to do that in the context of developing for Unreal on Windows and VisualStudio I'm not sure, as I don't really use Windows. Maybe some of the other Windows users around can help...

@vladinator1000
Copy link
Author

vladinator1000 commented Sep 11, 2023

I made some progress and uploaded the code to https://github.com/vladinator1000/ue-static-third-party-library-example

  1. Created a new module for the third-party dependencies. Using the Unreal module and third party docs as reference.
  2. Manually cloned these repositories and copy their "include" folder into my include folder
  3. Created a wrapper Unreal plugin that includes the Lager module. The idea is to export Unreal-compatible stuff from this so that people can use lager in their games easily.
  4. Copied the counter example.
  5. Tried creating a lager store using the counter inside the startup function of the Unreal plugin to test if the library will work.

Unfortunately this wouldn't compile with this error:

0>Counter.h(42): Error C4003 : not enough arguments for function-like macro invocation 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY'
0>Counter.h(42): Error C4003 : not enough arguments for function-like macro invocation 'BOOST_PP_SEQ_DETAIL_EMPTY_SIZE'
0>Counter.h(43): Error C4003 : not enough arguments for function-like macro invocation 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY'
0>Counter.h(43): Error C4003 : not enough arguments for function-like macro invocation 'BOOST_PP_SEQ_DETAIL_EMPTY_SIZE'
0>effect.hpp(127): Error C4003 : not enough arguments for function-like macro invocation 'check'
0>effect.hpp(127): Error C4003 : not enough arguments for function-like macro invocation 'UE_CHECK_IMPL'
0>effect.hpp(127): Error C2988 : unrecognizable template declaration/definition
0>effect.hpp(149): Reference C2988 : see reference to class template instantiation 'lager::result<Model,Action,Deps>' being compiled
0>effect.hpp(127): Error C2059 : syntax error: '<end Parse>'
0>effect.hpp(127): Error C2334 : unexpected token(s) preceding '{'; skipping apparent function body
0>effect.hpp(128): Error C2988 : unrecognizable template declaration/definition
0>effect.hpp(128): Error C2059 : syntax error: '{'
0>effect.hpp(128): Error C2334 : unexpected token(s) preceding '{'; skipping apparent function body
0>list.hpp(1336): Error C4003 : not enough arguments for function-like macro invocation 'check'
0>list.hpp(1336): Error C4003 : not enough arguments for function-like macro invocation 'UE_CHECK_IMPL'
0>list.hpp(1336): Error C2062 : type 'void' unexpected
0>list.hpp(1408): Reference C2062 : see reference to class template instantiation 'boost::intrusive::list_impl<ValueTraits,SizeType,ConstantTimeSize,HeaderHolder>' being compiled
0>list.hpp(1336): Error C2334 : unexpected token(s) preceding '{'; skipping apparent function body
0>list.hpp(1337): Error C4430 : missing type specifier - int assumed. Note: C++ does not support default-int
0>list.hpp(1337): Error C2059 : syntax error: '{'
0>list.hpp(1337): Error C2334 : unexpected token(s) preceding '{'; skipping apparent function body
0>xform_nodes.hpp(60): Error C4003 : not enough arguments for function-like macro invocation 'LAGER_THROW'
0>set.hpp(294): Error C2440 : '<function-style-cast>': cannot convert from 'initializer list' to 'boost::hana::detail::set_insert_if_contains<Ys>'
        with
        [
            Ys=deps<Ds...>::required_key_set
        ]
0>set.hpp(294): Reference C2440 : The target type has no constructors
0>intersection.hpp(28): Reference C2440 : see reference to function template instantiation 'auto boost::hana::intersection_impl<boost::hana::set_tag,void>::apply<const boost::hana::set<>&,deps<Ds...>::required_key_set>(Xs,const Ys &)' being compiled
        with
        [
            Xs=const boost::hana::set<> &,
            Ys=deps<Ds...>::required_key_set
        ]
0>deps.hpp(345): Reference C2440 : see reference to function template instantiation 'auto boost::hana::intersection_t::operator ()<const boost::hana::set<>&,deps<Ds...>::required_key_set&>(Xs,Ys) const' being compiled
        with
        [
            Xs=const boost::hana::set<> &,
            Ys=deps<Ds...>::required_key_set &
        ]
0>store.hpp(359): Reference C2440 : see reference to class template instantiation 'lager::deps<>' being compiled
0>store.hpp(391): Reference C2440 : see reference to function template instantiation 'auto lager::make_store<Action,Tag,_Ty,lager::with_manual_event_loop,const lager::identity_t&>(Model &&,EventLoop &&,const lager::identity_t &)' being compiled
        with
        [
            Action=counter::action,
            Tag=lager::automatic_tag,
            _Ty=counter::model,
            Model=counter::model,
            EventLoop=lager::with_manual_event_loop
        ]
0>Vod.cpp(16): Reference C2440 : see reference to function template instantiation 'auto lager::make_store<counter::action,lager::automatic_tag,counter::model,lager::with_manual_event_loop>(Model &&,EventLoop &&)' being compiled
        with
        [
            Model=counter::model,
            EventLoop=lager::with_manual_event_loop
        ]
0>partial.hpp(94): Error C3889 : call to object of class type 'boost::hana::detail::variadic::foldl1_t': no matching call operator found
0>foldl1.hpp(203): Reference C3889 : could be 'decltype(auto) boost::hana::detail::variadic::foldl1_t::operator ()(F &&,X1 &&,Xn &&...) const'
0>partial.hpp(94): Reference C3889 : 'decltype(auto) boost::hana::detail::variadic::foldl1_t::operator ()(F &&,X1 &&,Xn &&...) const': expects 3 arguments - 1 provided
0>tuple.hpp(229): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::partial_t<std::integer_sequence<size_t,0>,boost::hana::detail::variadic::foldl1_t,boost::hana::set<>>::operator ()<>(void) &&' being compiled
0>unpack.hpp(47): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::unpack_impl<boost::hana::tuple_tag,void>::apply<F>(const boost::hana::tuple<> &,F &&)' being compiled
        with
        [
            F=boost::hana::partial_t<std::integer_sequence<size_t,0>,boost::hana::detail::variadic::foldl1_t,boost::hana::set<>>
        ]
0>set.hpp(151): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::unpack_t::operator ()<const boost::hana::tuple<>&,F>(Xs,F &&) const' being compiled
        with
        [
            F=boost::hana::partial_t<std::integer_sequence<size_t,0>,boost::hana::detail::variadic::foldl1_t,boost::hana::set<>>,
            Xs=const boost::hana::tuple<> &
        ]
0>unpack.hpp(47): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::unpack_impl<boost::hana::set_tag,void>::apply<const boost::hana::set<>&,F>(Set,F &&)' being compiled
        with
        [
            F=boost::hana::partial_t<std::integer_sequence<size_t,0>,boost::hana::detail::variadic::foldl1_t,boost::hana::set<>>,
            Set=const boost::hana::set<> &
        ]
0>fold_left.hpp(92): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::unpack_t::operator ()<const boost::hana::set<>&,boost::hana::partial_t<std::integer_sequence<size_t,0>,boost::hana::detail::variadic::foldl1_t,boost::hana::set<>>>(Xs,F &&) const' being compiled
        with
        [
            Xs=const boost::hana::set<> &,
            F=boost::hana::partial_t<std::integer_sequence<size_t,0>,boost::hana::detail::variadic::foldl1_t,boost::hana::set<>>
        ]
0>fold_left.hpp(54): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::fold_left_impl<T,boost::hana::when<true>>::apply<const boost::hana::set<>&,F>(Xs,F &&)' being compiled
        with
        [
            T=boost::hana::set_tag,
            F=boost::hana::set<>,
            Xs=const boost::hana::set<> &
        ]
0>set.hpp(294): Reference C3889 : see reference to function template instantiation 'decltype(auto) boost::hana::fold_left_t::operator ()<const boost::hana::set<>&,boost::hana::set<>>(Xs,F &&) const' being compiled
        with
        [
            Xs=const boost::hana::set<> &,
            F=boost::hana::set<>
        ]
0>intersection.hpp(28): Error C2102 : '&' requires l-value
0>deps.hpp(342): Error C2676 : binary '==': 'const boost::hana::set<>' does not define this operator or a conversion to a type acceptable to the predefined operator
0>PimplPtr.h(307): Reference C2676 : could be 'bool operator ==(TYPE_OF_NULLPTR,const TPimplPtr<U,M> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TYPE_OF_NULLPTR,const TPimplPtr<U,M> &)': could not deduce template argument for 'const TPimplPtr<U,M> &' from 'void'
0>RefCounting.h(348): Reference C2676 : or       'bool operator ==(ReferencedType *,const TRefCountPtr<ReferencedType> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(ReferencedType *,const TRefCountPtr<ReferencedType> &)': could not deduce template argument for 'ReferencedType *' from 'const boost::hana::set<>'
0>WeakObjectPtrTemplates.h(294): Reference C2676 : or       'bool operator ==(TYPE_OF_NULLPTR,const TWeakObjectPtr<T,TWeakObjectPtrBase> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TYPE_OF_NULLPTR,const TWeakObjectPtr<T,TWeakObjectPtrBase> &)': could not deduce template argument for 'const TWeakObjectPtr<T,TWeakObjectPtrBase> &' from 'void'
0>WeakObjectPtrTemplates.h(288): Reference C2676 : or       'bool operator ==(const LhsT *,const TWeakObjectPtr<RhsT,OtherTWeakObjectPtrBase> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const LhsT *,const TWeakObjectPtr<RhsT,OtherTWeakObjectPtrBase> &)': could not deduce template argument for 'const LhsT *' from 'const boost::hana::set<>'
0>SharedPointer.h(1993): Reference C2676 : or       'bool operator ==(TYPE_OF_NULLPTR,const TWeakPtr<ObjectType,InMode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TYPE_OF_NULLPTR,const TWeakPtr<ObjectType,InMode> &)': could not deduce template argument for 'const TWeakPtr<ObjectType,InMode> &' from 'void'
0>SharedPointer.h(1981): Reference C2676 : or       'bool operator ==(const TWeakPtr<ObjectType,InMode> &,TYPE_OF_NULLPTR)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TWeakPtr<ObjectType,InMode> &,TYPE_OF_NULLPTR)': could not deduce template argument for 'const TWeakPtr<ObjectType,InMode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1969): Reference C2676 : or       'bool operator ==(const TSharedPtr<ObjectTypeA,Mode> &,const TWeakPtr<ObjectTypeB,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedPtr<ObjectTypeA,Mode> &,const TWeakPtr<ObjectTypeB,Mode> &)': could not deduce template argument for 'const TSharedPtr<ObjectTypeA,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1957): Reference C2676 : or       'bool operator ==(const TSharedRef<CastToType,Mode> &,const TWeakPtr<ObjectTypeB,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedRef<CastToType,Mode> &,const TWeakPtr<ObjectTypeB,Mode> &)': could not deduce template argument for 'const TSharedRef<CastToType,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1945): Reference C2676 : or       'bool operator ==(const TWeakPtr<ObjectTypeA,Mode> &,const TSharedPtr<ObjectTypeB,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TWeakPtr<ObjectTypeA,Mode> &,const TSharedPtr<ObjectTypeB,Mode> &)': could not deduce template argument for 'const TWeakPtr<ObjectTypeA,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1933): Reference C2676 : or       'bool operator ==(const TWeakPtr<ObjectTypeA,Mode> &,const TSharedRef<CastFromType,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TWeakPtr<ObjectTypeA,Mode> &,const TSharedRef<CastFromType,Mode> &)': could not deduce template argument for 'const TWeakPtr<ObjectTypeA,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1921): Reference C2676 : or       'bool operator ==(const TWeakPtr<ObjectTypeA,Mode> &,const TWeakPtr<ObjectTypeB,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TWeakPtr<ObjectTypeA,Mode> &,const TWeakPtr<ObjectTypeB,Mode> &)': could not deduce template argument for 'const TWeakPtr<ObjectTypeA,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1897): Reference C2676 : or       'bool operator ==(const TSharedPtr<ObjectTypeB,Mode> &,const TSharedRef<CastToType,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedPtr<ObjectTypeB,Mode> &,const TSharedRef<CastToType,Mode> &)': could not deduce template argument for 'const TSharedPtr<ObjectTypeB,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1873): Reference C2676 : or       'bool operator ==(const TSharedRef<CastToType,Mode> &,const TSharedPtr<ObjectTypeB,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedRef<CastToType,Mode> &,const TSharedPtr<ObjectTypeB,Mode> &)': could not deduce template argument for 'const TSharedRef<CastToType,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1825): Reference C2676 : or       'bool operator ==(TYPE_OF_NULLPTR,const TSharedPtr<ObjectType,InMode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TYPE_OF_NULLPTR,const TSharedPtr<ObjectType,InMode> &)': could not deduce template argument for 'const TSharedPtr<ObjectType,InMode> &' from 'void'
0>SharedPointer.h(1813): Reference C2676 : or       'bool operator ==(const TSharedPtr<ObjectType,InMode> &,TYPE_OF_NULLPTR)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedPtr<ObjectType,InMode> &,TYPE_OF_NULLPTR)': could not deduce template argument for 'const TSharedPtr<ObjectType,InMode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1801): Reference C2676 : or       'bool operator ==(const TSharedPtr<ObjectTypeA,Mode> &,const TSharedPtr<ObjectTypeB,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedPtr<ObjectTypeA,Mode> &,const TSharedPtr<ObjectTypeB,Mode> &)': could not deduce template argument for 'const TSharedPtr<ObjectTypeA,Mode> &' from 'const boost::hana::set<>'
0>SharedPointer.h(1777): Reference C2676 : or       'bool operator ==(const TSharedRef<CastToType,Mode> &,const TSharedRef<CastFromType,Mode> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(const TSharedRef<CastToType,Mode> &,const TSharedRef<CastFromType,Mode> &)': could not deduce template argument for 'const TSharedRef<CastToType,Mode> &' from 'const boost::hana::set<>'
0>ArrayView.h(816): Reference C2676 : or       'bool operator ==(TArrayView<ElementType,int32>,RangeType &&)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TArrayView<ElementType,int32>,RangeType &&)': could not deduce template argument for 'TArrayView<ElementType,int32>' from 'const boost::hana::set<>'
0>ArrayView.h(805): Reference C2676 : or       'bool operator ==(RangeType &&,TArrayView<ElementType,int32>)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(RangeType &&,TArrayView<ElementType,int32>)': could not deduce template argument for 'TArrayView<ElementType,int32>' from 'void'
0>ArrayView.h(790): Reference C2676 : or       'bool operator ==(TArrayView<InElementType,InSizeType>,TArrayView<OtherElementType,OtherSizeType>)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TArrayView<InElementType,InSizeType>,TArrayView<OtherElementType,OtherSizeType>)': could not deduce template argument for 'TArrayView<InElementType,InSizeType>' from 'const boost::hana::set<>'
0>UniquePtr.h(767): Reference C2676 : or       'bool operator ==(TYPE_OF_NULLPTR,const TUniquePtr<T,TDefaultDelete<T>> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TYPE_OF_NULLPTR,const TUniquePtr<T,TDefaultDelete<T>> &)': could not deduce template argument for 'const TUniquePtr<T,TDefaultDelete<T>> &' from 'void'
0>Function.h(1045): Reference C2676 : or       'bool operator ==(TYPE_OF_NULLPTR,const TFunction<T> &)'
0>deps.hpp(342): Reference C2676 : 'bool operator ==(TYPE_OF_NULLPTR,const TFunction<T> &)': could not deduce template argument for 'const TFunction<T> &' from 'void'
0>comparable.hpp(36): Reference C2676 : or       'auto boost::hana::detail::operators::operator ==(X &&,Y &&)'
0>deps.hpp(345): Reference C2676 : 'auto boost::hana::detail::operators::operator ==(X &&,Y &&)': could not deduce template argument for '<unnamed-symbol>'
0>array.hpp(95): Reference C2676 : or       'bool boost::hana::detail::operator ==(boost::hana::detail::array<T,Size>,boost::hana::detail::array<U,N>)'
0>deps.hpp(342): Reference C2676 : 'bool boost::hana::detail::operator ==(boost::hana::detail::array<T,Size>,boost::hana::detail::array<U,N>)': could not deduce template argument for 'boost::hana::detail::array<T,Size>' from 'const boost::hana::set<>'
0>deps.hpp(363): Error C3889 : call to object of class type 'boost::hana::intersection_t': no matching call operator found
0>intersection.hpp(26): Reference C3889 : could be 'auto boost::hana::intersection_t::operator ()(Xs &&,Ys &&) const'
0>deps.hpp(363): Reference C3889 : Failed to specialize function template 'auto boost::hana::intersection_t::operator ()(Xs &&,Ys &&) const'
0>deps.hpp(363): Reference C3889 : With the following template arguments:
0>deps.hpp(363): Reference C3889 : 'Xs=const boost::hana::set<> &'
0>deps.hpp(363): Reference C3889 : 'Ys=void'
0>store.hpp(40): Error C3200 : 'lager::detail::reader_node<T>': invalid template argument for template parameter 'Base', expected a class template
        with
        [
            T=model_t
        ]
[5/5] WriteMetadata LibEditor.target cancelled

I'm not sure what I did wrong here, my current theories are:

  • for Counter.h that I have the wrong boost/preprocessor version
  • for effect.hpp the syntax errors make me think that I'm compiling with the wrong C++ version. The Unreal docs say they compile with C++ 20 currently.

Something makes me think that UE and boost are fundamentally incompatible.

@kevin--
Copy link

kevin-- commented May 9, 2024

The real issue I believe to be MSVC -- there are several other threads here where we have been fighting with MSVC see #126

Some users have been migrating to using clang under MSVC, but I don't know if that is supported by Unreal.

@kevin--
Copy link

kevin-- commented May 9, 2024

If you are using vcpkg, lager is provided and will resolve all dependencies for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants