Menu

How I to link static library "libmgl.a" on Win10 use MinGW?

Help
yun
2021-08-03
2022-03-20
  • yun

    yun - 2021-08-03

    I would like to ask how to use the static link library of Mathgl in my program.

    Now, I use "-Lmathgl-2.4.4.LGPL-mingw.win64/lib -lmgl" in my project, compile and links can be completed to generate execute file, but when i run execute file, it tell me find not "libmgl.dll", why?

    I clearly tell the linker to use the static library in path "mathgl-2.4.4.LGPL-mingw.win64/lib/libmgl.a", but in the end, the dynamic link library is used.

    How I to link static library?

     
  • yun

    yun - 2021-08-03

    Of course, I also added "-DMGL_STATIC_DEFINE" macro definition

     
    • vktrax

      vktrax - 2022-03-08

      Were you able to solve it. I'm too facing similar issue, bin contains libmgl-wx.dll and libmgl.dll, even though static flag is set

       

      Last edit: vktrax 2022-03-08
  • vktrax

    vktrax - 2022-03-20

    For anyone facing similar issue, to use static build of mathGL in your application, EXPORT can be disabled from your CMake target as
    target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE mgl_EXPORTS=0)

     

Log in to post a comment.