Repository: FloatingArrayDesign/MoorDyn (language: python)

Issue:
error in 'MoorDyn.build>mingw32-make'
/(ㄒoㄒ)/~~
Please tell me why.

E:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\bodies.dir/objects.a(bodies.cpp.obj):bodies.cpp:(.text+0x168e): undefined reference to `moordyn::Euler2Quat(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
collect2.exe: error: ld returned 1 exit status


Discussion / hints:
Probably our fault. Please, provide us with the full list of commands you
typed and the logs/outputs

On Wed, 16 Aug 2023, 08:10 dustelf, ***@***.***> wrote:

> /(ㄒoㄒ)/~~
> Please tell me why.
>
> E:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
> CMakeFiles\bodies.dir/objects.a(bodies.cpp.obj):bodies.cpp:(.text+0x168e):
> undefined reference to `moordyn::Euler2Quat(Eigen::Matrix<double, 3, 1, 0,
> 3, 1> const&)'
> collect2.exe: error: ld returned 1 exit status
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/FloatingArrayDesign/MoorDyn/issues/107>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAMXKKBBBVVKWPGU3NQ4G33XVRP5PANCNFSM6AAAAAA3SAQL7I>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>

> 可能是我们的错。请向我们提供您命令的完整列表 类型和日志/输出
> [...](#)
> 周三， 16 八月 2023， 08：10 dustelf， ***@***.***> 写道： /（ㄒoㄒ）/~~ 请告诉我为什么。 E：/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-W64-MINGW32/bin/ld.exe： CMakeFiles\bodies.dir/objects.a（bodies.cpp.obj）：bodies.cpp：（.text+0x168e）： 未定义对 'moordyn：：Euler2Quat（Eigen：：Matrix<double， 3， 1， 0， 3， 1> 常量&）' collect2.exe：错误：LD 返回 1 个退出状态 — 直接回复此电子邮件，在 GitHub 上查看 [<#107>](https://github.com/FloatingArrayDesign/MoorDyn/issues/107)，或 退订 <https://github.com/notifications/unsubscribe-auth/AAMXKKBBBVVKWPGU3NQ4G33XVRP5PANCNFSM6AAAAAA3SAQL7I> . 您收到此消息是因为您订阅了此线程。消息 编号： ***@***.***>

I just followed your steps and entered this command on cmd "mingw32-make"/(ㄒoㄒ)/~~

[ 88%] Built target bodies_and_rods
[ 89%] Building CXX object tests/CMakeFiles/bodies.dir/bodies.cpp.obj
[ 89%] Linking CXX executable bodies.exe
E:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\bodies.dir/objects.a(bodies.cpp.obj):bodies.cpp:(.text+0x168e): undefined reference to `moordyn::Euler2Quat(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [tests\CMakeFiles\bodies.dir\build.make:100: tests/bodies.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1322: tests/CMakeFiles/bodies.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2
I am out of the office the whole august. I will check this out ASAP.

On Thu, 17 Aug 2023, 03:34 dustelf, ***@***.***> wrote:

> 可能是我们的错。请向我们提供您命令的完整列表 类型和日志/输出
> ... <#m_-3705658133954852350_>
> 周三， 16 八月 2023， 08：10 dustelf， *@*.*> 写道： /（ㄒoㄒ）/~~ 请告诉我为什么。
> E：/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-W64-MINGW32/bin/ld.exe：
> CMakeFiles\bodies.dir/objects.a（bodies.cpp.obj）：bodies.cpp：（.text+0x168e）：
> 未定义对 'moordyn：：Euler2Quat（Eigen：：Matrix<double， 3， 1， 0， 3， 1> 常量&）'
> collect2.exe：错误：LD 返回 1 个退出状态 — 直接回复此电子邮件，在 GitHub 上查看 <#107>
> <https://github.com/FloatingArrayDesign/MoorDyn/issues/107>，或 退订
> https://github.com/notifications/unsubscribe-auth/AAMXKKBBBVVKWPGU3NQ4G33XVRP5PANCNFSM6AAAAAA3SAQL7I
> <https://github.com/notifications/unsubscribe-auth/AAMXKKBBBVVKWPGU3NQ4G33XVRP5PANCNFSM6AAAAAA3SAQL7I>
> . 您收到此消息是因为您订阅了此线程。消息 编号： @.*>
>
> I just followed your steps and entered this command on cmd
> "mingw32-make"/(ㄒoㄒ)/~~
>
> [ 88%] Built target bodies_and_rods
> [ 89%] Building CXX object tests/CMakeFiles/bodies.dir/bodies.cpp.obj
> [ 89%] Linking CXX executable bodies.exe
> E:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
> CMakeFiles\bodies.dir/objects.a(bodies.cpp.obj):bodies.cpp:(.text+0x168e):
> undefined reference to `moordyn::Euler2Quat(Eigen::Matrix<double, 3, 1, 0,
> 3, 1> const&)'
> collect2.exe: error: ld returned 1 exit status
> mingw32-make[2]: *** [tests\CMakeFiles\bodies.dir\build.make💯
> tests/bodies.exe] Error 1
> mingw32-make[1]: *** [CMakeFiles\Makefile2:1322:
> tests/CMakeFiles/bodies.dir/all] Error 2
> mingw32-make: *** [Makefile:165: all] Error 2
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/FloatingArrayDesign/MoorDyn/issues/107#issuecomment-1681478012>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAMXKKEDUWNUEHGWW6BWMWTXVVYMBANCNFSM6AAAAAA3SAQL7I>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>

> I am out of the office the whole august. I will check this out ASAP.
> […](#)
> On Thu, 17 Aug 2023, 03:34 dustelf, ***@***.***> wrote: 可能是我们的错。请向我们提供您命令的完整列表 类型和日志/输出 ... <#m_-3705658133954852350_> 周三， 16 八月 2023， 08：10 dustelf， *@*.*> 写道： /（ㄒoㄒ）/~~ 请告诉我为什么。 E：/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-W64-MINGW32/bin/ld.exe： CMakeFiles\bodies.dir/objects.a（bodies.cpp.obj）：bodies.cpp：（.text+0x168e）： 未定义对 'moordyn：：Euler2Quat（Eigen：：Matrix<double， 3， 1， 0， 3， 1> 常量&）' collect2.exe：错误：LD 返回 1 个退出状态 — 直接回复此电子邮件，在 GitHub 上查看 <#107> <#107>，或 退订 https://github.com/notifications/unsubscribe-auth/AAMXKKBBBVVKWPGU3NQ4G33XVRP5PANCNFSM6AAAAAA3SAQL7I <https://github.com/notifications/unsubscribe-auth/AAMXKKBBBVVKWPGU3NQ4G33XVRP5PANCNFSM6AAAAAA3SAQL7I> . 您收到此消息是因为您订阅了此线程。消息 编号： @.*> I just followed your steps and entered this command on cmd "mingw32-make"/(ㄒoㄒ)/~~ [ 88%] Built target bodies_and_rods [ 89%] Building CXX object tests/CMakeFiles/bodies.dir/bodies.cpp.obj [ 89%] Linking CXX executable bodies.exe E:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\bodies.dir/objects.a(bodies.cpp.obj):bodies.cpp:(.text+0x168e): undefined reference to `moordyn::Euler2Quat(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)' collect2.exe: error: ld returned 1 exit status mingw32-make[2]: *** [tests\CMakeFiles\bodies.dir\build.make💯 tests/bodies.exe] Error 1 mingw32-make[1]: *** [CMakeFiles\Makefile2:1322: tests/CMakeFiles/bodies.dir/all] Error 2 mingw32-make: *** [Makefile:165: all] Error 2 — Reply to this email directly, view it on GitHub <[#107 (comment)](https://github.com/FloatingArrayDesign/MoorDyn/issues/107#issuecomment-1681478012)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAMXKKEDUWNUEHGWW6BWMWTXVVYMBANCNFSM6AAAAAA3SAQL7I> . You are receiving this because you commented.Message ID: ***@***.***>

ok,ok

Fix patch:
diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml
new file mode 100644
index 00000000..1208dd1d
--- /dev/null
+++ b/.github/workflows/build-mingw.yml
@@ -0,0 +1,36 @@
+name: CMake
+
+on:
+  push:
+    branches: [ $default-branch, master, v2 ]
+  pull_request:
+    branches:
+      - "**"
+
+env:
+  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
+  BUILD_TYPE: Release
+  CC: "gcc"
+  CXX: "g++"
+
+jobs:
+  build_mingw:
+    runs-on: ${{ matrix.os }}
+    strategy:
+        matrix:
+            os: [windows-latest]
+
+    steps:
+    - uses: actions/checkout@v3
+
+    - name: Create folders
+      run: |
+          mkdir -p ${{github.workspace}}/install
+          mkdir -p ${{github.workspace}}/build
+
+    - name: Configure CMake
+      run: cmake -B ${{github.workspace}}/build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=ON -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=OFF -DBUILD_TESTING=ON
+
+    - name: Build
+      id: build
+      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index e640cbe3..3985b3ad 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -81,7 +81,9 @@ set_property(TARGET moordyn APPEND PROPERTY
 )
 if(${CMAKE_VERSION} VERSION_GREATER "3.15") 
   message("Using Precompiled Headers!")
-  target_precompile_headers(moordyn PRIVATE Misc.hpp)
+  if (NOT WIN32 OR MSVC)
+    target_precompile_headers(moordyn PRIVATE Misc.hpp)
+  endif()
 endif()
 target_compile_definitions(moordyn PUBLIC MoorDyn_EXPORTS)
 target_link_libraries(moordyn PUBLIC ${MOORDYN_PUBLIC_DEPS})
diff --git a/source/Misc.cpp b/source/Misc.cpp
index 3f6c87ef..7dd50ba5 100644
--- a/source/Misc.cpp
+++ b/source/Misc.cpp
@@ -170,22 +170,6 @@ fileToLines(const std::filesystem::path& path)
 
 } // ::moordyn::fileIO
 
-vec3
-Quat2Euler(const quaternion& q)
-{
-	return q.toRotationMatrix().eulerAngles(0, 1, 2);
-}
-
-quaternion
-Euler2Quat(const vec3& angles)
-{
-	using AngleAxis = Eigen::AngleAxis<real>;
-	quaternion q = AngleAxis(angles.x(), vec3::UnitX()) *
-	               AngleAxis(angles.y(), vec3::UnitY()) *
-	               AngleAxis(angles.z(), vec3::UnitZ());
-	return q;
-}
-
 XYZQuat
 XYZQuat::operator+(const XYZQuat& visitor) const
 {
diff --git a/source/Misc.hpp b/source/Misc.hpp
index 68a466ee..f570e529 100644
--- a/source/Misc.hpp
+++ b/source/Misc.hpp
@@ -124,11 +124,21 @@ typedef ivec3 ivec;
 
 typedef std::complex<real> complex;
 
-vec3
-Quat2Euler(const quaternion& q);
+inline vec3
+Quat2Euler(const quaternion& q)
+{
+	return q.toRotationMatrix().eulerAngles(0, 1, 2);
+}
 
-quaternion
-Euler2Quat(const vec3& angles);
+inline quaternion
+Euler2Quat(const vec3& angles)
+{
+	using AngleAxis = Eigen::AngleAxis<real>;
+	quaternion q = AngleAxis(angles.x(), vec3::UnitX()) *
+	               AngleAxis(angles.y(), vec3::UnitY()) *
+	               AngleAxis(angles.z(), vec3::UnitZ());
+	return q;
+}
 
 struct XYZQuat
 {
@@ -179,7 +189,7 @@ const complex i1(0., 1.);
  * @param a The output array
  */
 template<typename T>
-void
+inline void
 vec2array(const vec& v, T* a)
 {
 	a[0] = (T)v[0];
@@ -205,7 +215,7 @@ array2vec(const T* a, vec& v)
  * @param a The output array
  */
 template<typename T>
-void
+inline void
 vec62array(const vec6& v, T* a)
 {
 	a[0] = (T)v[0];
@@ -569,7 +579,7 @@ rtrim(string& s);
 
 /** @brief Split a string into separate letter strings and integers
  */
-int
+int DECLDIR
 decomposeString(const std::string& outWord,
                 std::string& let1,
                 std::string& num1,
@@ -623,7 +633,7 @@ typedef enum
  * @param vec 6x1 Vector (b in M * a = b)
  * @return vec6 Resulting solution (a in M * a = b)
  */
-vec6
+vec6 DECLDIR
 solveMat6(const mat6& mat, const vec6& vec);
 
 /** \defgroup transformations 3D transformations
@@ -691,7 +701,7 @@ getH(vec r)
  * @param M Mass matrix
  * @return Translated Mass & Inertia matrix
  */
-mat6
+mat6 DECLDIR
 translateMass(vec r, mat M);
 
 /** @brief Compute the mass matrix on an offset point
@@ -699,7 +709,7 @@ translateMass(vec r, mat M);
  * @param M Mass & Inertia matrix
  * @return Translated Mass & Inertia matrix
  */
-mat6
+mat6 DECLDIR
 translateMass6(vec r, mat6 M);
 
 /** @brief rotation to a 3x3 mass matrix or any other second order tensor
@@ -722,7 +732,7 @@ rotateMass(mat R, mat M)
  * @param M Mass & Inertia matrix
  * @return Rotated mass
  */
-mat6
+mat6 DECLDIR
 rotateMass6(mat R, mat6 M);
 
 /** @brief calculate position and velocity of point based on its position


Test patch:
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index e2675955..debd2a1a 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -2,9 +2,10 @@ name: CMake
 
 on:
   push:
-    branches: [ $default-branch, master, v2-make-wheels ]
-  pull_request:
     branches: [ $default-branch, master, v2 ]
+  pull_request:
+    branches:
+      - "**"
 
 permissions: write-all
 
@@ -114,7 +115,6 @@ jobs:
 
     - name: Build
       id: build
-      # Build your program with the given configuration
       run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
 
     - name: Test (Linux)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f5dd35cd..57408555 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -24,7 +24,6 @@ set(TESTS
     io
     rods
     bodies_and_rods
-    bodies
     quasi_static_chain
     wavekin_4
     tripod
@@ -34,6 +33,7 @@ set(TESTS
 set(CPP_TESTS 
     wavekin
     wavekin_7
+    bodies
 )
 
 set(CATCH2_TESTS