Menu

how to link to msvcr90.dll?

Help
shuchang
2011-12-31
2013-06-06
  • shuchang

    shuchang - 2011-12-31

    How to link to msvcr90.dll use mingw-w64?

    gcc hello.c -nostdlib -lmsvcr90 -lgcc -o hello.exe

    #include <stdio.h>
    int main()
    {
    printf("hello world");
    return 0;
    }
    

    the error is :
    "
    c:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/libgcc.a(__main.o): In function `_do_global_ctors':
    /home/ruben/mingw-w64/toolchain/src/gcc/libgcc/../gcc/libgcc2.c:2164: undefined reference to `atexit'
    collect2: ld returned 1 exit status

    "

     
  • rubenvb

    rubenvb - 2011-12-31

    You shouldn't be using "-nostdlib". That removes all MinGW-w64 support libraries. Just link with "-lmsvcr90" and you will get the desired result.

     
  • shuchang

    shuchang - 2011-12-31

    i use the following command 

    gcc -lmsvcr90 hello.c -o hello.exe
    

    compling is fine.

    run the hello.exe   then  error dialog appear  with message  "   attempt to load the C runtime library incorrectly"

    …..any idea???

     
  • Kai Tietz

    Kai Tietz - 2012-01-01

    The issue about using msvcr90 runtime is, that your application has to provide an manifest file.  Either you can include it as resource into your application, or you can distribute the manifest-file next to your application.
    Without this manifest, your built application rejects to start.

     

Log in to post a comment.