Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6170725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:05:22+00:00 2026-05-23T23:05:22+00:00

How can one link Visual C++ (2010) console app with a STATIC library created

  • 0

How can one link Visual C++ (2010) console app with a STATIC library created by MinGW (*.a format)? Is it compatible with Visual C++ 2010?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:05:22+00:00Added an answer on May 23, 2026 at 11:05 pm

    It’s not compatible.

    However, if you extract all the object files from the library (use ar), the VC++ linker is able to deal with those (I tested it, although I used cygwin gcc rather than mingw gcc). Note that you may still have name mangling problems if you don’t use extern "C".

    You may of course use VC++’s LIB.EXE tool to make these into a static library in VC++ format.


    As @Michael points out, you will definitely have problems if you try to pass non-POD C++ objects between modules built with different compilers. The fix for this is the same as the DLL case: write a wrapper built with the same compiler (in this case mingw) that exposes a C-compatible interface usable from other toolchains.


    // minimal.cpp
    extern "C" int m(void) { return 7; }
    

    $ gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.5.0/lto-wrapper.exe
    Target: i686-pc-cygwin
    Configured with: /gnu/gcc/releases/respins/4.5.0-1/gcc4-4.5.0-1/src/gcc-4.5.0/co
    nfigure --srcdir=/gnu/gcc/releases/respins/4.5.0-1/gcc4-4.5.0-1/src/gcc-4.5.0 --
    prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdi
    r=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --dataroo
    tdir=/usr/share --docdir=/usr/share/doc/gcc4 --datadir=/usr/share --infodir=/usr
    /share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable
    -bootstrap --enable-version-specific-runtime-libs --libexecdir=/usr/lib --enable
    -static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu
    -ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada
    ,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-lto --enable-jav
    a-awt=gtk --disable-symvers --enable-libjava --program-suffix=-4 --enable-libgom
    p --enable-libssp --enable-libada --enable-threads=posix --with-arch=i686 --with
    -tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4 CC_FOR_TARGET=gcc-4 CXX
    _FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind --wi
    th-ecj-jar=/usr/share/java/ecj.jar
    Thread model: posix
    gcc version 4.5.0 (GCC)
    
    $ gcc -c minimal.cpp
    

    // minmain.cpp
    extern "C" int m(void);
    
    #include <iostream>
    
    int main(void) { std::cout << m() << "\n"; }
    

    R:\>cl /c /EHsc minmain.cpp
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    minmain.cpp
    
    R:\>link minmain.obj minimal.o
    Microsoft (R) Incremental Linker Version 10.00.40219.01
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    
    R:\>minmain
    7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can some one provide a link to create a simple server and client using
I'm curious. I have a library (static and dynamic version) compiled with visual studio
I'm trying to build a C/C++ static library using visual studio 2005. Since the
I have a C# solution composed of three projects in Visual Sudio 2010. One
Can one place an arbitrary program (firefox, openoffice, etc...) in a QX11EmbedContainer? The fllowing
Can one of you smarties point me to some beginner content for converting an
Can one upload files to a domain other than the domain a script originates
Can one call a method from another model in a model in CodeIgniter? I
Can one transaction update two different TVar s in an atomic way? i.e. can
How can one tell, given a void * pointer, what is the size of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.