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

Compilation error in Windows (VS 2017) #20

Open
Danl2620 opened this issue Mar 20, 2019 · 5 comments
Open

Compilation error in Windows (VS 2017) #20

Danl2620 opened this issue Mar 20, 2019 · 5 comments
Assignees

Comments

@Danl2620
Copy link

Danl2620 commented Mar 20, 2019

Building on Windows I get this compilation error:

afsm\include\afsm/definition.hpp(231): error C2977: 'afsm::def::traits::inner_states_definitions': too many template arguments
afsm\include\afsm/detail/def_traits.hpp(151): note: see declaration of 'afsm::def::traits::inner_states_definitions'
afsm\include\afsm/definition.hpp(254): note: see reference to class template instantiation 'afsm::def::state_machine_def<T,Tags...>' being compiled
afsm\include\afsm/definition.hpp(232): error C2143: syntax error: missing ';' before '>'
afsm\include\afsm/definition.hpp(232): error C2059: syntax error: '>'
afsm\include\afsm/definition.hpp(232): error C2238: unexpected token(s) preceding ';'
@zmij
Copy link
Owner

zmij commented Mar 20, 2019

Could you please be a little more specific? What are you building? Just the library? Which git branch are you using?

Unfortunately I don't have a Windows machine, so I've never tried to compile the library with VS.

@Danl2620
Copy link
Author

I'm including afsm/fsm.hpp into a .cpp file in an Unreal project which is building on windows using VS 2017. My branch is develop. We're also building on macOS using clang and it does not have this compile error...

@zmij
Copy link
Owner

zmij commented Mar 27, 2019

The library requires my other library https://github.com/zmij/metapushkin and in CMake environment it is downloaded as an external project.
Can you put the metapushkin includes into your include search paths and give it another try?

@zmij zmij self-assigned this Mar 28, 2019
@Jedzia
Copy link

Jedzia commented Mar 22, 2020

I had problems with these ExternalProjectX shenanigans, too

In a folder with CMakeLists.txt
and afsm + metapushkin as submodules, declare:

add_library(afsm INTERFACE)
target_include_directories(afsm INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/metapushkin/include;${CMAKE_CURRENT_SOURCE_DIR}/afsm/include")

add_library(afsm::afsm ALIAS afsm)

that enables you to

target_link_libraries(YOUR_TARGET PRIVATE afsm::afsm)

when just using the headers

@Skoparov
Copy link

Skoparov commented Mar 25, 2021

I'm not sure if it's still relevant, but the issue seems to be that msvc doesn't handle specializing template classes with template typedefs all that well. Simply changing state to state_def in inner_states_definitions<state<StateMachine, Tags...>> fixed the problem for me.

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

No branches or pull requests

4 participants