ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.15k stars 440 forks source link

CSV library fails to link on Windows with Threads ON #24

Closed breznak closed 8 years ago

breznak commented 8 years ago

I have an issue linking the library to our project on Windows, you can see the original report and Appveyor output at: https://github.com/numenta/nupic.core/pull/890#issuecomment-222244767

In the followup we tried adding pthread as suggested, but didn't help, so we resolved to a workaround with disabled multithreading on Win (-DCSV_IO_NO_THREAD).

It's not critical but would be nice if the Win version worked the same as on UNIXes.

ben-strasser commented 8 years ago

Hi,

if I understand you correctly, then the error that you are getting is

C:/projects/nupic-core/external/common/include/csv.h:275:30: error: 'thread' in namespace 'std' does not name a type

which means that your compiler is broken in the sense that it does not implement the C++11 standard threading interface (in the year 2016!) and is thus not supported. If you use a compiler which does implement C++11, such as I believe the newer VC++ compilers, then the library will also compile on Windows.

I will not reimplement stuff in terms of the native Windows threading functions just because some compiler vendor fails at its job of providing standardized interfaces.

You have two options:

  1. Stick with -DCSV_IO_NO_THREAD
  2. Fix your compiler. I believe the following links could be of help to you http://stackoverflow.com/questions/21211980/mingw-error-thread-is-not-a-member-of-std and https://github.com/meganz/mingw-std-threads

Best Regards Ben Strasser

breznak commented 8 years ago

Ben, thank you for the helpful links!

We are using GCC 4.9 from mingwpy (I'm surprised it does not implement c++11 correctly)

FYI @rcrowder maybe you'll be able to give a better insight

rcrowder commented 8 years ago

Apologies for commenting on this closed issue. We do use a posix and seh GCC variant on Windows for building the C++ nupic.core (MinGWPy), but don't require pthread (or winpthread) support within the core itself currently. With the various issues with thread and exception handling on MinGW-w64 based GCC variants, I'm inclined to stick with the CSV_IO_NO_THREAD option right now (relying on Python to handle threading required in the nupic python code base across all supported OS).