You are not logged in.

#1 2010-11-19 21:17:39

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

mingw32-g++ linking issues?

I'm having some issues with mingw32 package. Latest from community. Maybe I'm not just doing it right... heh. Posting here first since most programmers on this forum probably hang around here big_smile

C programs work:

#include <stdio.h>

int main(void)
{
   printf("hai world\n");
   return 0;
}

Command line:

i486-mingw32-gcc -o test.exe test.c 

and works.

Now to C++... No programs compiled will run. The compile seemingly though...

i486-mingw32-g++ -o test.exe test.cpp
Info: resolving std::cout  by linking to __imp___ZSt4cout (auto-import)
/usr/lib/gcc/i486-mingw32/4.5.0/../../../../i486-mingw32/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.

code:

#include <iostream>

int main()
{
   std::cout << "hai" << std::endl;
}

Running it in wine it immediately returns and returns with error code: 53

Anyone else experiencing this? Very annoying to fire up Windows to compile some stuff for a friend sad

Edit: It complains about libstdc++-6.dll not being found, even though it's in /usr/i486-mingw32/lib :x
Edit2: It works with -static, but that's a bit annoying. No better way of doing it?

Last edited by Themaister (2010-11-19 21:28:26)

Offline

#2 2010-11-23 06:43:10

vadmium
Member
Registered: 2010-11-02
Posts: 63

Re: mingw32-g++ linking issues?

Themaister wrote:

It complains about libstdc++-6.dll not being found, even though it's in /usr/i486-mingw32/lib :x
It works with -static, but that's a bit annoying. No better way of doing it?

My guess is you need to have the C++ DLL installed on the target (Wine, and your friend's computer), and I'm guessing /usr/i486-mingw32/lib is nothing to do with Wine. Static linking sucks in the whole library at compile time; dynamic linking only needs an "import library" but you need the DLL available at run time.

It should be possible to verify this by looking at the dependencies of your exe file (not sure the best way though). I used to use mingw and msys natively on Windows, and had an ldd shell script I could run there to do this.

Offline

Board footer

Powered by FluxBB