3

I have 2 build environments with different versions of MinGW: one configured for Qt and one not. Both, however, have the stub static libraries of Qt (which end up actually linking to the dlls). The problem is that I want to build a static library in the Qt MinGW and then include it in the non Qt MinGW. I get the following link errors when I try:

moc_browser.cpp:(.eh_frame+0x11): undefined reference to `___gxx_personality_v0'
browser.cpp:(.text+0x213): undefined reference to `__Unwind_Resume'

I found that the Qt MinGW is linking dynamically to the standard libraries and that i need to include the option -static-libgcc. However, I do not know where to use it since I am not building an executable, but rather a static library.

chacham15
  • 13,719
  • 26
  • 104
  • 207

1 Answers1

3

A static library is just a collection of object files - an archive. You don't create it by linking, but with an archiving program (often ar). To include the object files of another static library in a new one, you have to find the relevant options for the archiving program to merge them.

eriktous
  • 6,569
  • 2
  • 25
  • 35
  • 2
    see http://stackoverflow.com/questions/3821916/how-to-merge-two-ar-static-libraries-into-one/9330267#9330267 for options of `ar` – osgx Feb 17 '12 at 19:58
  • Good call, or go to the source: http://sourceware.org/binutils/docs-2.22/binutils/ar-cmdline.html#ar-cmdline – eriktous Feb 17 '12 at 20:02