-
-
Notifications
You must be signed in to change notification settings - Fork 899
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
EnTT really work on windows ? #96
Comments
Fortunately yes, or at least appveyor says so. |
for my ci -> https://ci.appveyor.com/project/Milerius/shiva cmake part of entt: include(CMakeSources.cmake)
set(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_path(ENTT_INCLUDE_DIR entt/entt.hpp)
MSG_YELLOW_BOLD(STATUS "ENTT_INCLUDE_DIR: " "${ENTT_INCLUDE_DIR}" "")
CREATE_MODULE(shiva::entt "${MODULE_SOURCES}" ${MODULE_PATH})
target_include_directories(shiva-entt INTERFACE ${ENTT_INCLUDE_DIR}) namespace shiva::error
{
class general_handler
{
public:
void receive(const shiva::event::fatal_error_occured &evt)
{
entity_registry_.each([this](auto entity) {
this->entity_registry_.destroy(entity);
}); // doesn't compile on windows
dispatcher_.trigger<shiva::event::quit_game>(evt.ec_.value());
}
general_handler(entt::dispatcher &dispatcher, entt::entity_registry &entity_registry) noexcept :
dispatcher_(dispatcher),
entity_registry_(entity_registry)
{
this->dispatcher_.sink<shiva::event::fatal_error_occured>().connect(this);
if (shiva::fs::exists("stacktrace/backtrace.dump")) {
// there is a backtrace
std::ifstream ifs("stacktrace/backtrace.dump");
shiva::bs::stacktrace st = shiva::bs::stacktrace::from_dump(ifs);
std::cerr << "Previous run crashed:\n" << st << std::endl;
// cleaning up
ifs.close();
shiva::fs::remove("stacktrace/backtrace.dump");
}
}
private:
entt::dispatcher &dispatcher_;
entt::entity_registry &entity_registry_;
}; as you can see it's compile on Linux on my ci, but not on windows :/ |
I found the problem I'm compiling with flags / permissive- https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance permissive-: my program now compiles without /permissive- |
So, Windows has a flag that makes our code more portable by rejecting valid code? :-D |
i dont know but may be we can look together if you want, or report an error to MSVC team |
I was already looking at the error, but I don't know how to solve it.
Not sure about a workaround that doesn't affect everything. |
If i reminder, std::min on windows is a macro, may be it's the problem, we can try to do our own min function and try with /permissive- to compile entt i will ask in #msvc channel in cpplang.sh slack |
A macro? Why that? The language is mandatory about Btw, if it's a macro, why it doesn't complain without permissive flag? |
It's does with /W4 msvc flags Combined with /permissive- it's turn this warning into an illegal error I think the solution it's to use own min function for windows, since they didn't plan to remove this macro i think |
It seems you can solve the problem your side by defining a macro that disable those macros (it makes me cry). |
This:
Should be put before any other If it solves your problem, well, it would confirm that it's in charge to users to turn off such annoying macros on Windows. |
i will put in my cmake a compile definition that define NOMINMAX, ty (use boost/stacktrace.hpp in my project that include windows.h) and windows.h have a macro min/max... sorry |
Don't worry, it's not a problem of my fault or your fault. |
thanks ! i close the issue ! |
Hey using vcpkg + entt 2.6.1
this snippet doesn't compile with the following error
ecs-test.cpp
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(567): warning C4003: not enough actual parameters for macro 'min' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(625): warning C4003: not enough actual parameters for macro 'min' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(633): warning C4003: not enough actual parameters for macro 'max' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(756): warning C4003: not enough actual parameters for macro 'min' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(552): error C2589: '(': illegal token on right side of '::' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(901): note: see reference to class template instantiation 'entt::View<Entity,Component...>' being compiled
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(567): error C2589: '(': illegal token on right side of '::' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(625): error C2589: '(': illegal token on right side of '::' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(633): error C2589: '(': illegal token on right side of '::' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
c:\tools\vcpkg\installed\x64-windows\include\entt\entity\view.hpp(756): error C2589: '(': illegal token on right side of '::' [C:\projects\shiva\build\tests\ecs-test\ecs-test.vcxproj]
The text was updated successfully, but these errors were encountered: