kimwalisch / primesieve

🚀 Fast prime number generator
BSD 2-Clause "Simplified" License
968 stars 123 forks source link

Trouble Compiling on MinGW #51

Closed c4n10 closed 6 years ago

c4n10 commented 6 years ago

Hello,

I am trying to compile on MinGW and the basic build instructions are not working.

If I run: cmake . make -j from the root directory it gives this error: make: *** No targets specified and no makefile found. Stop.

I was able to work around that by: cd cmake cmake .. -G"Unix Makefiles"

However now when I run make -j I am receiving these errors: $ make -j Scanning dependencies of target libprimesieve-static [ 4%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/api-c.cpp.obj [ 9%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/api.cpp.obj [ 13%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/CpuInfo.cpp.obj [ 18%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/EratBig.cpp.obj [ 22%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/EratMedium.cpp.obj [ 27%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/EratSmall.cpp.obj [ 31%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/iterator-c.cpp.obj [ 36%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/nthPrime.cpp.obj [ 40%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/iterator.cpp.obj[ 45%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/ParallelPrimeSieve.cpp.obj [ 50%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/popcount.cpp.obj [ 54%] [ 59%] [ 68%] [ 68%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/PrimeSieve.cpp.obj Building CXX object CMakeFiles/libprimesieve-static.dir/src/PreSieve.cpp.obj[ 72%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/PrimeGenerator.cpp.obj

[ 77%] Building CXX object CMakeFiles/libprimesieve-static.dir/src/SieveOfEratosthenes.cpp.objBuilding CXX object CMakeFiles/libprimesieve-static.dir/src/Wheel.cpp.objBuilding CXX object CMakeFiles/libprimesieve-static.dir/src/SievingPrimes.cpp.obj

C:/InIMi nnfG IifnlWi e/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp: In member function 'void primesieve::CpuInfo::initCache()': C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:189:36: warning: 'stdcall' attribute only applies to function types [-Wattributes] lf typedef BOOL (WINAPI LPFNGLPI)(PSYSTEM LOGICAL_PROCESSOR_INFORMATION, PDWORD); ^~~~~~~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:189:36: error: typedef 'LPFN_GLPI' is initialized (use decltype instead) eiC:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:189:36: error: 'PSYSTEM_LOGICAL_PROCESSOR_INFORMATION' was not declared in this scope C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:189:81: error: expected primary-expression befiore ')' token typedef BOOL (WINAPI LPFN_GLPI)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD); ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:191:3: error: 'LPFN_GLPI' was not declared in this scope l LPFN_GLPI glpi = (LPFN_GLPI) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetLogicalProcessorInformation"); ^~~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:193:8: error: 'glpi' was not declared in this scope if (!glpi) ^~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfon.cpp:197:17: error: 'glpi' was not declared in this scope glpi(0, &bytes); ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:203:32: error: 'SYSTEM_LOGICAL_PROCESSOR_INFORMATION' was not declared in this scope size_t size = bytes / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); ^~~~~~ie~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:204:10: error: the value of 'SYSTEM_LOGICAL_PROCESSOR_INFORMATIONc' is not usable in a constant expression vector info(size); ^~~~~~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:203:32: note: 'SYSTEM_LOGICAL_PROCESSOR_INFORMATION' was not declared 'constexpr' size_t size = bytes / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); ^~~~~~~~ n C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:204:46: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' l vector info(size); ^ C:/MicnGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:204:46: note: expected a type, got 'SYSTEM_LOGICAL_PROCESSOR_IiuNFORMATION' C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:204:46: error: template argument 2 is invalid C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:206:20: error: invalid types 'int[int]' for array subscript l if (!glpi(&info[0], &bytes)) nd ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:211:15: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript if (info[i].Relationship == RelationProcessorCore) ^ Cu:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:211:33: error: 'RelationProcessorCore' was not declared in this scope if (info[i].Relationship == RelationProcessorCore) ^~~~~ ceC:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpdp:213:25: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript auto mask = info[i].ProcessorMask; ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/srlc/CpuInfo.cpp:222:15: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript if (info[i].Reldaeu tionsddfhip == RelationCache && ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src er/CpuInfo.cpp:222:33: error: 'RelationCache'fdo was not declared in this scope if (info[i].Relationship == RelationCache && ^~~~~ C:/MinGW/msys/1.0/home/c4n10/primesiever m/src/CpuInfo.cpp:223:16: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript (info[i].Cache.Type == CacheData || ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:223:32: error: 'CacheData' was not declared in this scope of (info[i].Cache.Type == CacheData || ^~~~~ mrCC:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:224:16: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript info[i].Cache. o:Type == CacheUnified)) ^ C:/MinGW/msys/1.0/home/c4n10/primeCm/sieve/s: Mrc/CpuInfo.cCip/p:224:32: error: 'CacheUnified' was not declared in this scope info[i].Cache.Ty:nM/GiMWni/GnmWGs/Wym/ssm/ys1sy./s01//.1h0.o/0mh/eoh/mocem4/enc/14c0n4/1np01r/0ip/mrpeirsmiiemeseviseei/vesevr/ecs//rsacrp/cia/.pPciap-rpca:.l1cl7pe:ppe == CacheUnified)) ^~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:226:17: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript if (info[i].Cache.Level == 1) ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.c0l:pp:227:30: error: invalid types 'int[sizet {aka unsigned int}]' f:P1or array subscript l1CacheSize = info[i].Cache.Size; ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:228:17: error: invalid types 'int[size_t {aka unsigned int}]' for r6 array subscript if (info[i].Cache.Level == 2) ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:229:30: error: invalid types 'int[sizet {aka unsigned int}]' for array subscript l2CacheSize = info[i].Cache.Size; ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:233:17: error: invalid types 'int[size_t {aka unsigned int}]' for array subscript if (info[i].Cache.Level == 3 && ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/CpuInfo.cpp:234:17: error: invalid types 'int[sizet {aka unsigned int}]' for array subscript info[i].Cache.Size > 0) ^ i:Cm0:e:/S ieCnmake[2]: v:G [CMakeFiles/libprimesieve-static.dir/src/CpuInfo.cpp.obj] Error 1e/W.M/ spmake[2]: Gy:W Waiting for unfinished jobs.... /2m1:s.0y0:s/ 1oC.m:0e///Mhcio4nmnGe1W/0/c/m4psnry1is0m//e1ps.ri0ie/mvheeos/miieen/vccel4/unid1ne0c//lppurrdiiemm/eepssriiieemvveees//iPieanvrceal/luPldaeerl/aPplrrliiemmleePSsriiieemvveeeS./ihPepavpre:a.4lh7lp:ep8l::P4 r7ei:rm8re:oS rie:er vr'eom.ruh:tp ep'x:m'4u 7ti:en8x :'n aeimrner sonpraa:mc ee's mp'uastcteedx ''' sditonde 'sn adnmooeetss p nanacomete 'nasa tmtdey' p aed ey sp e n tt d :n :asmmtuedt :ea:x m tulytopecexk l; o k s t; d : m u t ^e ~x ~ ~l ~o^ k~_~;~

    ^~~~~

make[2]: [CMakeFiles/libprimesieve-static.dir/src/api.cpp.obj] Error 1 make[2]: [CMakeFiles/libprimesieve-static.dir/src/api-c.cpp.obj] Error 1 C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp: In static member function 'static int primesieve::ParallelPrimeSieve::getMaxThreads()': C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:59:22: error: 'thread' has not been declared return max(1, thread::hardware_concurrency()); ^~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp: In member function 'virtual void primesieve::ParallelPrimeSieve::sieve()': C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:169:53: error: invalid use of incomplete type 'class std::future<std::vector >' futures.emplaceback(async(launch::async, task)); ^ In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector >' class future; ^~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:172:19: error: invalid use of incomplete type 'class std::future<std::vector >' counts += f.get(); ^ In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector >' class future; ^~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp: In member function 'virtual bool primesieve::ParallelPrimeSieve::updateStatus(uint64_t, bool)': C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:194:15: error: 'mutex' was not declared in this scope uniquelock lock(lock, defer_lock); ^~~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:194:20: error: template argument 1 is invalid uniquelock lock(lock, deferlock); ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:194:27: error: 'lock' was not declared in this scope uniquelock lock(lock, defer_lock); ^~~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:194:44: error: expression list treated as compound expression in initializer [-fpermissive] uniquelock lock(lock, defer_lock); ^ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:197:10: error: request for member 'try_lock' in 'lock', which is of non-class type 'int' lock.try_lock(); ^~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:199:10: error: request for member 'lock' in 'lock', which is of non-class type 'int' lock.lock(); ^~~~ C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:201:12: error: request for member 'owns_lock' in 'lock', which is of non-class type 'int' if (lock.owns_lock()) ^~~~~ In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:69:0, from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17, from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15, from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc: In instantiation of 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::future<std::vector >; _Alloc = std::allocator<std::future<std::vector > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]': C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:166:28: required from here c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:80:4: error: invalid use of incomplete type 'class std::future<std::vector >' this->_M_impl._M_end_of_storage

    - this->_M_impl._M_start);
    ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector<long long unsigned int> >'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:69:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:82:36: error: invalid use of incomplete type 'class std::future<std::vector<long long unsigned int> >'
    this->_M_impl._M_finish = __tmp + __old_size;
                              ~~~~~~^~~~~~~~~~~~
In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector<long long unsigned int> >'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:69:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:83:61: error: invalid use of incomplete type 'class std::future<std::vector<long long unsigned int> >'
    this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
                                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector<long long unsigned int> >'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_algobase.h:67:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:60,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_iterator.h: In instantiation of '__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::future<std::vector<long long unsigned int> >*; _Container = std::vector<std::future<std::vector<long long unsigned int> > >]':
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:171:20:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_iterator.h:799:2: error: cannot increment a pointer to incomplete type 'std::future<std::vector<long long unsigned int> >'
  ++_M_current;
  ^~~~~~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:64:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >]':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:259:15:   required from 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >]'
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:165:30:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:161:9: error: invalid use of incomplete type 'class std::future<std::vector<long long unsigned int> >'
       { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
     - this->_M_impl._M_start); }
     ^~~~~~~~~~~~~~~~~~~~~~~~

In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector >' class future; ^~ In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:64:0, from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17, from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15, from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::capacity() const [with _Tp = std::future<std::vector >; _Alloc = std::allocator<std::future<std::vector > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]': c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:70:28: required from 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::future<std::vector >; _Alloc = std::allocator<std::future<std::vector > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]' C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:166:28: required from here c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:737:5: error: invalid use of incomplete type 'class std::future<std::vector >' { return size_type(this->_M_impl._M_end_of_storage

     - this->_M_impl._M_start); }
     ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector<long long unsigned int> >'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:64:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:72:37:   required from 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:166:28:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:656:50: error: invalid use of incomplete type 'class std::future<std::vector<long long unsigned int> >'
       { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
                          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'class std::future<std::vector<long long unsigned int> >'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:62:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_construct.h: In instantiation of 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::future<std::vector<long long unsigned int> >*]':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_construct.h:151:15:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = std::future<std::vector<long long unsigned int> >*; _Tp = std::future<std::vector<long long unsigned int> >]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:426:22:   required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >]'
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:165:30:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_construct.h:127:11: error: invalid use of incomplete type 'std::iterator_traits<std::future<std::vector<long long unsigned int> >*>::value_type {aka class std::future<std::vector<long long unsigned int> >}'
       std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::

destroy(first, __last);


In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'std::iterator_traits<std::future<std::vector<long long unsigned int> >*>::value_type {aka class std::future<std::vector<long long unsigned int> >}'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++allocator.h:33:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\allocator.h:46,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:61,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\new_allocator.h: In instantiation of '__gnu_cxx::new_allocator<_Tp>::size_type __gnu_cxx::new_allocator<_Tp>::max_size() const [with _Tp = std::future<std::vector<long long unsigned int> >; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\alloc_traits.h:476:29:   required from 'static std::allocator_traits<std::allocator<_Tp1> >::size_type std::allocator_traits<std::allocator<_Tp1> >::max_size(const allocator_type&) [with _Tp = std::future<std::vector<long long unsigned int> >; std::allocator_traits<std::allocator<_Tp1> >::size_type = unsigned int; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::future<std::vector<long long unsigned int> > >]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:661:39:   required from 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::max_size() const [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:68:15:   required from 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:166:28:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\new_allocator.h:114:35: error: invalid application of 'sizeof' to incomplete type 'std::future<std::vector<long long unsigned int> >'
       { return size_t(-1) / sizeof(_Tp); }
                                   ^
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:63:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_uninitialized.h: In instantiation of '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<std::future<std::vector<long long unsigned int> >*>; _ForwardIterator = std::future<std::vector<long long unsigned int> >*]':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_uninitialized.h:281:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<std::future<std::vector<long long unsigned int> >*>; _ForwardIterator = std::future<std::vector<long long unsigned int> >*; _Tp = std::future<std::vector<long long unsigned int> >]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:1225:35:   required from 'std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::move_iterator<std::future<std::vector<long long unsigned int> >*>; _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::pointer = std::future<std::vector<long long unsigned int> >*; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:75:70:   required from 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:166:28:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_uninitialized.h:124:12: error: invalid use of incomplete type 'std::__iterator_traits<std::move_iterator<std::future<std::vector<long long unsigned int> >*>, void>::value_type {aka class std::future<std::vector<long long unsigned int> >}'
            && __is_trivial(_ValueType2)

In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'std::__iterator_traits<std::move_iterator<std::future<std::vector<long long unsigned int> >*>, void>::value_type {aka class std::future<std::vector<long long unsigned int> >}'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:63:0,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_uninitialized.h:124:12: error: invalid use of incomplete type 'std::iterator_traits<std::future<std::vector<long long unsigned int> >*>::value_type {aka class std::future<std::vector<long long unsigned int> >}'
            && __is_trivial(_ValueType2)

In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:115:11: note: declaration of 'std::iterator_traits<std::future<std::vector<long long unsigned int> >*>::value_type {aka class std::future<std::vector<long long unsigned int> >}'
     class future;
           ^~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++allocator.h:33:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\allocator.h:46,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\vector:61,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/PrimeSieve.hpp:17,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/include/primesieve/ParallelPrimeSieve.hpp:15,
                 from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:12:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\new_allocator.h: In instantiation of '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(__gnu_cxx::new_allocator<_Tp>::size_type, const void*) [with _Tp = std::future<std::vector<long long unsigned int> >; __gnu_cxx::new_allocator<_Tp>::pointer = std::future<std::vector<long long unsigned int> >*; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\alloc_traits.h:416:32:   required from 'static _Tp* std::allocator_traits<std::allocator<_Tp1> >::allocate(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, std::allocator_traits<std::allocator<_Tp1> >::size_type) [with _Tp = std::future<std::vector<long long unsigned int> >; std::allocator_traits<std::allocator<_Tp1> >::pointer = std::future<std::vector<long long unsigned int> >*; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::future<std::vector<long long unsigned int> > >; std::allocator_traits<std::allocator<_Tp1> >::size_type = unsigned int]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:170:33:   required from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::_Vector_base<_Tp, _Alloc>::pointer = std::future<std::vector<long long unsigned int> >*; std::size_t = unsigned int]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\stl_vector.h:1222:44:   required from 'std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::move_iterator<std::future<std::vector<long long unsigned int> >*>; _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::pointer = std::future<std::vector<long long unsigned int> >*; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\vector.tcc:75:70:   required from 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::future<std::vector<long long unsigned int> >; _Alloc = std::allocator<std::future<std::vector<long long unsigned int> > >; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:166:28:   required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\new_allocator.h:104:54: error: invalid application of 'sizeof' to incomplete type 'std::future<std::vector<long long unsigned int> >'
  return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
                                                      ^
In file included from C:/MinGW/msys/1.0/home/c4n10/primesieve/src/ParallelPrimeSieve.cpp:21:0:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future: At global scope:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\future:179:5: error: 'std::future<typename std::result_of<typename std::decay<_Tp>::type(typename std::decay<_BoundArgs>::type ...)>::type> std::async(std::launch, _Fn&&, _Args&& ...) [with _Fn = primesieve::ParallelPrimeSieve::sieve()::<lambda()>&; _Args = {}; typename std::result_of<typename std::decay<_Tp>::type(typename std::decay<_BoundArgs>::type ...)>::type = std::vector<long long unsigned int>]', declared using local type 'primesieve::ParallelPrimeSieve::sieve()::<lambda()>', is used but never defined [-fpermissive]
     async(launch __policy, _Fn&& __fn, _Args&&... __args);
     ^~~~~
make[2]: *** [CMakeFiles/libprimesieve-static.dir/src/ParallelPrimeSieve.cpp.obj] Error 1
make[1]: *** [CMakeFiles/libprimesieve-static.dir/all] Error 2
make: *** [all] Error 2

Any help would be greatly appreciated, thanks.
kimwalisch commented 6 years ago

Hi,

I actually had similar issues (linker failures) on one of my PCs when compiling with MinGW 64-bit but on my other PC it worked file. So today I completely uninstalled MinGW 64-bit from my PC where compilation failed and then reinstalled it using the instructions below:

1) Download MSYS2 installer from http://www.msys2.org/ 2) After MSYS2 installation open "MSYS2 MinGW 64-bit" and update using pacman -Syu. Run update step twice to be sure everything has been updated. 3) Install MinGW 64-bit using pacman -S --needed base-devel unzip mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake 4) Now you should be able to compile primesieve using:

wget https://github.com/kimwalisch/primesieve/archive/master.zip
unzip master.zip
cd primesieve-master
mkdir build
cd build

cmake .. -G "Unix Makefiles"
make -j8

Please let me know if this works for you.

c4n10 commented 6 years ago

I can confirm, this solution DID work for me, thank you.