Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "'asprintf' was not declared in this scope" when building with MinGW-W64 #146

Open
jdx-gh opened this issue Sep 7, 2022 · 0 comments

Comments

@jdx-gh
Copy link

jdx-gh commented Sep 7, 2022

Here is the patch:

diff --git a/src/bootstrap/SupportTree.cpp b/src/bootstrap/SupportTree.cpp
index 388744a..e028b1d 100644
--- a/src/bootstrap/SupportTree.cpp
+++ b/src/bootstrap/SupportTree.cpp
@@ -1,3 +1,10 @@
+#ifdef __MINGW32__
+// for asprintf
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#endif
+
 #include "SupportTree.hpp"
 
 using namespace std;
diff --git a/src/io/NewickStream.cpp b/src/io/NewickStream.cpp
index 9b7eb34..b06a528 100644
--- a/src/io/NewickStream.cpp
+++ b/src/io/NewickStream.cpp
@@ -1,3 +1,10 @@
+#ifdef __MINGW32__
+// for asprintf
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#endif
+
 #include "file_io.hpp"
 
 using namespace std;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant