error: 'to_string' is not a member of 'std' (on Cygwin)
Issue #378
resolved
After 2e15c552, I get the following error when building DOLFIN on Cygwin:
...
2014/09/09 20:33:46 - INFO: [package:run_job] [ 40%] Building CXX object dolfin/CMakeFiles/dolfin.dir/io/HDF5File.cpp.o
2014/09/09 20:33:50 - INFO: [package:run_job] /home/johannr/.hashdist/tmp/dolfin-m2db6rzykoso/dolfin/io/HDF5File.cpp: In member function 'void dolfin::HDF5File::write(const dol\
fin::Mesh&, std::size_t, std::string)':
2014/09/09 20:33:50 - INFO: [package:run_job] /home/johannr/.hashdist/tmp/dolfin-m2db6rzykoso/dolfin/io/HDF5File.cpp:395:63: error: 'to_string' is not a member of 'std'
2014/09/09 20:33:50 - INFO: [package:run_job] const std::string marker_dataset = name + "/domain_" + std::to_string(d);
2014/09/09 20:33:50 - INFO: [package:run_job] ^
2014/09/09 20:33:50 - INFO: [package:run_job] /home/johannr/.hashdist/tmp/dolfin-m2db6rzykoso/dolfin/io/HDF5File.cpp: In member function 'void dolfin::HDF5File::read(dolfin::Me\
sh&, std::string, bool) const':
2014/09/09 20:33:50 - INFO: [package:run_job] /home/johannr/.hashdist/tmp/dolfin-m2db6rzykoso/dolfin/io/HDF5File.cpp:1437:65: error: 'to_string' is not a member of 'std'
2014/09/09 20:33:50 - INFO: [package:run_job] const std::string marker_dataset = mesh_name + "/domain_" + std::to_string(d);
2014/09/09 20:33:50 - INFO: [package:run_job] ^
2014/09/09 20:33:52 - INFO: [package:run_job] dolfin/CMakeFiles/dolfin.dir/build.make:2219: recipe for target 'dolfin/CMakeFiles/dolfin.dir/io/HDF5File.cpp.o' failed
2014/09/09 20:33:52 - INFO: [package:run_job] CMakeFiles/Makefile2:173: recipe for target 'dolfin/CMakeFiles/dolfin.dir/all' failed
2014/09/09 20:33:52 - INFO: [package:run_job] make[2]: *** [dolfin/CMakeFiles/dolfin.dir/io/HDF5File.cpp.o] Error 1
2014/09/09 20:33:52 - INFO: [package:run_job] make[1]: *** [dolfin/CMakeFiles/dolfin.dir/all] Error 2
2014/09/09 20:33:52 - INFO: [package:run_job] Makefile:116: recipe for target 'all' failed
2014/09/09 20:33:52 - INFO: [package:run_job] make: *** [all] Error 2
2014/09/09 20:33:52 - ERROR: [package:run_job] Command '[u'/bin/bash', '_hashdist/build.sh']' returned non-zero exit status 2
2014/09/09 20:33:52 - ERROR: [package:run_job] command failed (code=2); raising
This is apparently a bug in Cygwin, however, the following simple patch fixes the problem:
diff --git a/dolfin/io/HDF5File.cpp b/dolfin/io/HDF5File.cpp
index 81d6f19..7669826 100644
--- a/dolfin/io/HDF5File.cpp
+++ b/dolfin/io/HDF5File.cpp
@@ -34,6 +34,7 @@
#include <dolfin/common/MPI.h>
#include <dolfin/common/NoDeleter.h>
#include <dolfin/common/Timer.h>
+#include <dolfin/common/utils.h>
#include <dolfin/fem/GenericDofMap.h>
#include <dolfin/function/Function.h>
#include <dolfin/function/FunctionSpace.h>
@@ -392,7 +393,7 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
std::map<std::size_t, std::size_t>::const_iterator it;
for (it = domain.begin(); it != domain.end(); ++it)
collection.set_value(it->first, it->second);
- const std::string marker_dataset = name + "/domain_" + std::to_string(d);
+ const std::string marker_dataset = name + "/domain_" + to_string(d);
write_mesh_value_collection(collection, marker_dataset);
}
@@ -1434,7 +1435,7 @@ void HDF5File::read(Mesh& input_mesh, const std::string mesh_name,
// Check if we have any domains
for (std::size_t d = 0; d <= input_mesh.topology().dim(); ++d)
{
- const std::string marker_dataset = mesh_name + "/domain_" + std::to_string(d);
+ const std::string marker_dataset = mesh_name + "/domain_" + to_string(d);
if (!has_dataset(marker_dataset))
continue;
Comments (7)
-
reporter -
Is your Cygwin up-to-date? May have been fixed in recent versions of Cygwin, see http://cygwin.com/ml/cygwin-announce/2013-12/msg00002.html
-
reporter @garth-wells - Yes, I upgraded after I noticed that error but I still got the same problem. The GCC version is 4.8.3.
-
reporter This was fixed in 066b8cfe.
-
reporter - changed status to resolved
-
- removed milestone
Removing milestone: 1.5 (automated comment)
-
reporter Same problem reported now on the FEniCS support mailing list.
- Log in to comment
There is a different fix for this in 066b8cfe.