-
Notifications
You must be signed in to change notification settings - Fork 472
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
Failing to build with MinGW64 on Windows #397
Comments
The problem can be solved by replacing |
That's weird because we are checking the compilation of JSBSim on MinGW32 and it succeeds without an error. However after googling the issue, I came across the issue msys2/MINGW-packages#1342 and it seems that the flag Could you try compiling with > "C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_CXX_FLAGS_RELEASE="-D_POSIX_C_SOURCE" --build c:\dev\builds\jsbsim\Debug-MinGW-w64 --target all -- -j 8
Could you be more specific which line of code from which file are you talking about ? |
The thing is I've search through project files and found a place where the preprocessor checked not only for PS C:\dev\repos\jsbsim> git diff master
diff --git a/src/JSBSim.cpp b/src/JSBSim.cpp
index 8f3828f4..b609bf0d 100644
--- a/src/JSBSim.cpp
+++ b/src/JSBSim.cpp
@@ -494,7 +494,7 @@ int real_main(int argc, char* argv[])
time_t tod;
time(&tod);
struct tm local;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
localtime_s(&local, &tod);
#else
localtime_r(&tod, &local);
@@ -565,7 +565,7 @@ int real_main(int argc, char* argv[])
// PRINT ENDING CLOCK TIME
time(&tod);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
localtime_s(&local, &tod);
#else
localtime_r(&tod, &local);
diff --git a/src/models/flight_control/FGMagnetometer.cpp b/src/models/flight_control/FGMagnetometer.cpp
index bee2e7b6..14218bde 100644
--- a/src/models/flight_control/FGMagnetometer.cpp
+++ b/src/models/flight_control/FGMagnetometer.cpp
@@ -75,7 +75,7 @@ FGMagnetometer::FGMagnetometer(FGFCS* fcs, Element* element)
time_t rawtime;
time( &rawtime );
struct tm ptm;
- #ifdef _MSC_VER
...skipping...
@@ -75,7 +75,7 @@ FGMagnetometer::FGMagnetometer(FGFCS* fcs, Element* element)
time_t rawtime;
time( &rawtime );
struct tm ptm;
- #ifdef _MSC_VER
+ #if defined(_MSC_VER) || defined(__MINGW32__)
gmtime_s(&ptm, &rawtime);
#else
gmtime_r(&rawtime, &ptm); |
Thanks. Have you tried compiling with |
Everything compiles now |
Running CMake:
Building stops due to an error in
JSBSim.cpp
.The text was updated successfully, but these errors were encountered: