0

I've written code that compiles, and executes on Linux without issue using gcc. However, the same code doesn't appear to be compiling on Windows using MinGW. Here is the code snippet:

std::future<void> gameTimer;

This is the error that I get:

In file included from ..\prohect\main.cpp:1:0: field 'gameTimer' has incomplete type 'std::future<void>
    std::future<void> gameTimer;
                      ^~~~~~~~~
In file included from ..\project\project.h:12:0, from ..\project\main.cpp:1: declaration of 'class std::future<void>'
    class future;
          ^~~~~~

Am I missing something from the MinGW installation?

humroben
  • 87
  • 9
  • What is your MinGW/GCC/libstdc++ version? [Possibly relevant](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735) – Jodocus Dec 06 '17 at 12:44
  • The version currently installed is 6.3.0-1 – humroben Dec 06 '17 at 12:46
  • You most likely need to include some header file. Incomplete type means that you only said that this class exist but you have not actually implemented it so there is something like `class A;` instead of `class A {....}`. Maybe you need to include future `#include `. – apalomer Dec 06 '17 at 12:46
  • The header is already included, otherwise it wouldn't have compiled on Linux – humroben Dec 06 '17 at 12:48
  • @humroben no, that does **not** follow. – Yakk - Adam Nevraumont Dec 06 '17 at 12:51
  • This is because MinGW does not support future as mentioned [here](https://stackoverflow.com/a/10471936). – saha Jul 24 '18 at 00:40

0 Answers0