|
From: John B. <joh...@ho...> - 2011-01-01 18:30:42
|
Chris Sutcliffe <ir0nh34d@...> writes:
>
> On 4 December 2010 23:39, Simson Garfinkel wrote:
> > I've tried searching for this in the archives of the mailing list but
> > couldn't find it.
> > I finally got my program to compile and link. Unfortunately I'm getting
> > these weird errors about auto-import. I've tried adding the
> > "--enable-auto-import" to my link flags and it doesn't make the errors go
> > away. When I add --enable-auto-import to my CXXFLAGS or CPPFLAGS, the
> > configure script fails.
> > Any ideas?
>
> Try: -Wl,--enable-auto-import
>
> Chris
>
-Wl,--enable-auto-import makes the warning go away, but the underlying
issue is that the .o file contains names like __ZSt4cout and is being
linked to an import library that contains names like __imp___ZSt4cout.
Surely it is a bug if my simple C++ program
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "Hello, world!" << endl;
return 0;
}
requires -Wl,--enable-auto-import to avoid a warning. If g++ wants
to link to an import library by default, then it should decorate
function names appropriately by default.
Of course, another way to avoid the warning is to pass -static
to make it use the static library instead.
I see that for C programs, printf is declared as
_CRTIMP int __cdecl __MINGW_NOTHROW printf (const char*, ...);
The _CRTIMP macro is not used in the C++ header files. Should it be?
By the way, is meant by "This should work unless it involves constant
data structures referencing symbols from auto-imported DLLs"?
Regards,
Alias John Brown.
|