hugoam/toy

Can't compile

f0086 opened this issue · 1 comments

f0086 commented

I compiled straight from git HEAD:

...
In file included from ../../../src/core/Core.h:10,
                 from ../../../src/core/Core.cpp:7:
../../../src/core/World/Section.h:97:15: error: ‘function’ in namespace ‘std’ does not name a template type
  typedef std::function<void()> TaskFunc;
               ^~~~~~~~
../../../src/core/World/Section.h:97:10: note: ‘std::function’ is defined in header ‘<functional>’; did you forget to ‘#include <functional>’?
../../../src/core/World/Section.h:18:1:
+#include <functional>
 #endif
../../../src/core/World/Section.h:97:10:
  typedef std::function<void()> TaskFunc;
          ^~~
../../../src/core/World/Section.h:109:17: error: ‘TaskFunc’ has not been declared
   void add_task(TaskFunc task) { m_task_queue.push(task); }
                 ^~~~~~~~
../../../src/core/World/Section.h:113:17: error: ‘TaskFunc’ was not declared in this scope
   LocklessQueue<TaskFunc> m_task_queue;
                 ^~~~~~~~
../../../src/core/World/Section.h:113:17: note: suggested alternative: ‘Task’
   LocklessQueue<TaskFunc> m_task_queue;
                 ^~~~~~~~
                 Task
../../../src/core/World/Section.h:113:25: error: template argument 1 is invalid
   LocklessQueue<TaskFunc> m_task_queue;
                         ^
../../../src/core/World/Section.h: In member function ‘void toy::QueueSection::add_task(int)’:
../../../src/core/World/Section.h:109:47: error: request for member ‘push’ in ‘((toy::QueueSection*)this)->toy::QueueSection::m_task_queue’, which is of non-class type  int’
   void add_task(TaskFunc task) { m_task_queue.push(task); }
                                               ^~~~
EventFilter.cpp
make[1]: *** [toy.make:836: ../../linux64_gcc/obj/x64/Debug/toy/src/core/Core.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:93: toy] Error 2

Looks like some C++ version mismatch?

└─ $ ▶ g++ --version
g++ (GCC) 8.1.1 20180531
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Fixed: 8064852
I suppose depending on the standard library version, <functional> was already included by another of the std headers included by that file, but not with the one you're using.