Menu

libmingwex.a linker issues

Help
soonahn
2012-10-02
2017-12-19
  • soonahn

    soonahn - 2012-10-02

    I compiled mingw-w64 toolchain from source (version… 2.0.4) using a fully static build from a script provided by Zeranoe.
    I can compile executable just find on this build, and they work marvelous on Windows.

    However, I have a static library that I'm building in Windows.  This static library is being build using mingw-w64, and I'm including in it, libmingwex.a.
    When I built this project originally on mingw32&MSYS on a Windows machine, it worked wonderfully, and importing libmingwex.a had no issues whatsoever.

    However, I wanted to expand to 64bit and hence I started using mingw-w64, and cross-compiling from Linux (Ubuntu12.04 LTS).

    What I did was compile my static library, and imported libmingwex.a (along with some other libraries which work just fine…. also compiled on mingw-w64), and then attempted to build a executable using the static library.  This is where I got my linker issues.

    The issues I get when from the mingw-w64 static library (libmingwex.a) are linker issues (shown below)
    1>secretproject.lib(lib32_libmingwex_a-wassert.o) : error LNK2019: unresolved external symbol _mingw_app_type referenced in function __wassert
    1>secretproject.lib(lib32_libmingwex_a-exp.o) : error LNK2001: unresolved external symbol ___mingw_raise_matherr
    1>secretproject.lib(lib32_libmingwex_a-log.o) : error LNK2019: unresolved external symbol ___mingw_raise_matherr referenced in function _log
    1>GenVideoD.lib(lib32_libmingwex_a-sqrtf.o) : error LNK2001: unresolved external symbol ___mingw_raise_matherr
    1>secretproject.lib(lib32_libmingwex_a-cos.o) : error LNK2001: unresolved external symbol ___mingw_raise_matherr
    1>secretproject.lib(lib32_libmingwex_a-pow.o) : error LNK2001: unresolved external symbol ___mingw_raise_matherr
    1>secretproject.lib(lib32_libmingwex_a-sin.o) : error LNK2001: unresolved external symbol ___mingw_raise_matherr
    1>secretproject.lib(lib32_libmingwex_a-sqrt.o) : error LNK2001: unresolved external symbol ___mingw_raise_matherr
    1>secretproject.lib(lib32_libmingwex_a-_time32.o) : error LNK2019: unresolved external symbol __imp__time referenced in function __time32
    1>GenVideoD.lib(lib32_libmingwex_a-_mktime32.o) : error LNK2019: unresolved external symbol __imp__mktime referenced in function __mktime32
    1>secretproject.lib(lib32_libmingwex_a-_gmtime32.o) : error LNK2019: unresolved external symbol __imp__gmtime referenced in function __gmtime32
    1>secretproject.lib(lib32_libmingwex_a-_localtime32.o) : error LNK2019: unresolved external symbol __imp__localtime referenced in function __localtime32

    Now the errors I sort of understand.  the __imp__ prefix is appended when you're attempting to build a dll (_CRTIMP wasn't defined somewhere?), and the underscore prefix is attached because it's a Windows thing?
    That's where I'm confused.  I thought mingw-w64 was built to work with MSCV, yet I'm running into all these issues I hadn't before.

    Do I have to recompile mingw-w64 using a certain flag or is it possible to define these symbols locally?

    <3's to anyone for attempting to help.

     
  • Jonathan Yong

    Jonathan Yong - 2012-10-02

    Sorry, sharing static libraries with MSVC is not supported right now, the contributor who was supposed to work on this went MIA.

    The only sane way to do it right now is to use a DLL.

     
  • soonahn

    soonahn - 2012-10-02

    Can you give me a brief explanation on how to do this? (or provide a link to some documentation?)

     
  • soonahn

    soonahn - 2012-10-02

    Or did you mean building my library as a DLL opposed to a static library?

     
  • Jonathan Yong

    Jonathan Yong - 2012-10-02

    Yes, you'll have to build whatever you made from the mingw-w64 side as a DLL, build the appropriate export definition file, then use MSVC lib.exe to produce a .lib for MSVC.

     
  • letmaik

    letmaik - 2017-12-19

    Is this still the case or is it now possible to link against libmingwex.a from an MSVC built library?

     

Log in to post a comment.